|
In case someone runs into this in the future - Microsoft has released an update for SP1 for VS2008 Professional that addresses the problem I was having. I really think I applied it one time before, but maybe I got things out of sequence. Anyway, it's KB2483802, link: Download Visual Studio 2008 update for Windows Embedded Compact 7 from Official Microsoft Download Center[^]
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
Sorry to get more and more questions here, but with your support I am solving issues one by one
I got 2 errors:
error C3861: 'srandom': identifier not found
error C3861: 'random': identifier not found
the problem is I don't know how to replace them with Windows versions ... because I didn't found them as defined somewhere ... from your experience, what could be similar windows functions ?
|
|
|
|
|
|
These tho two calls are coming from a Linux code ... and I didn't found documentation about them.
|
|
|
|
|
|
Probably need to use srand() and rand() .
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
That worked. Thank you !!!
|
|
|
|
|
|
I have tried to use srand_s and rand_s , but no one is recognized by my compiler:
error C3861: 'srand_s': identifier not found
error C3861: 'rand_s': identifier not found
|
|
|
|
|
|
I have some code:
sid->identifier_authority
where sid is declared as:
const SID* sid
and the project say that sid is targeting to windows (WinNT.h):
typedef struct _SID {
...
} SID, *PISID;
but I also have (in some header file) inside my project another SID struct declared:
#ifdef SID
typedef struct {
u8 sub_authority_count;
SID_IDENTIFIER_AUTHORITY identifier_authority;
}SID;
#endif
how can I do to sid be as my SID struct, not as _SID windows struct ?
|
|
|
|
|
You need to use a namespace here to remove the ambiguity between types.
Check this thread to see how this can be solved, Why doesn't ANSI C have namespaces? - Stack Overflow.
Quote: how can I do to sid be as my SID struct, not as _SID windows struct ? Are you including both the header files? If they are in separate header files, you can try avoiding including a header file and SID will automatically be of your choice.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Is included only myfile.h, not WinNT.h ... still, the code take _SID because my SID structure is hidden after an #ifdef SID ... the fact is that if I define a SID I got another errors. And for that error see this post: Re: Redirect to my struct - C / C++ / MFC Discussion Boards[^]
modified 8-Jan-20 5:26am.
|
|
|
|
|
Inside myheader.h there is a lot for other structs and defines that is in conflict with those from Windows. SID_IDENTIFIER_AUTHORITY for example ... So, removing or renaming is not an option (I guess). But I am not figure out how to solve this conflict with namespacing ...
|
|
|
|
|
This is just going to lead to more and more problems for you. You need to isolate your definitions from the ones in Windows. You can do it with the use of namespaces, or changing the names in your local definitions. But either way, until you fix this issue you are wasting your time trying to build any of the code.
|
|
|
|
|
Thank you Richard.
"You can do it with the use of namespaces"
Can you give me a little pseudocode that show me how to do it ?
|
|
|
|
|
Namespaces are a C++ feature, and not available if you are using C only. Basically a namespace wraps a set of definitions so that they can be uniquely identified within a source listing. eg:
namespace MyLib {
class A {
int x;
...
};
}
namespace MyProj {
class A {
int y;
...
};
}
...
int main() {
MyProj::A a1; MyLib::A a2;
a1.y = a2.y; }
update:The last line of the sample code, above should be a1.y = a2.x , apologies for any confusion
If, however, you are using C, you've got two choices.
1) refactor you project so that your SID and the system SID never appear in the same source code file (otherwise known as a translation unit). That's not always possible, and even when it is, it's usually requires a lot of thought, care, and effort.
2) refactor you project and rename your SID to something else, eg MyProg_SID. That's still a lot of work, but its' probably a lot less work than option 1, above. Additionally, your IDE might provide a renaming tool that will do the grunt work for you. If not, you might be able to use the find and replace feature of your favorite text editor.
modified 8-Jan-20 10:07am.
|
|
|
|
|
That C code I modified as C++ code, so I could use namespaces 
|
|
|
|
|
It is not that straightforward unfortunately. A namespace is a qualifier that allows you to have objects with the same name in a single compilation unit. As a simple example:
namespace foo
{
typedef struct
{
int bar;
} FOOBAR;
};
namespace gaa
{
typedef struct
{
char bar;
} FOOBAR;
};
int main
{
foo::FOOBAR foobar; foobar.bar = 10;
gaa::FOOBAR gaabar; gaabar.bar = 'X';
}
|
|
|
|
|
The field names are not an issue you just need the struct, typedef and pointer to have different names
As Richard said it's going to bite you find a different name.
If you want to try a different name with minimal typing go to your file myheader.h and at the top after the guard put these
#define _SID _mySID
#define SID mySID
#define PISID myPISID
now go to the very bottom and put these
#undef _SID
#undef SID
#undef PISID
Now your SID is called mySID to all other units because it just does a text substitute
If you are happy it is all well the make the change permanently using Edit->find & replace on the file using Visual Studio.
In vino veritas
|
|
|
|
|
Interesting idea, and it works for this case, but inside that myheader.h, I have several structs with names as windows have ... so, I guess is not productive renaming structs ... that is why I am thinking seriously at namespaces ... but I don't know how to use it yet.
modified 9-Jan-20 1:33am.
|
|
|
|
|
Why are you including two definitions for the same structure? Either remove the duplicate or rename one of them to keep them unique.
|
|
|
|
|
Maybe it's a typo?
You could try to change #ifdef to #ifndef ; which would make much more sense anyway since there is not point in defining something which has already been defined elsewhere.
"Five fruits and vegetables a day? What a joke!
Personally, after the third watermelon, I'm full."
|
|
|
|
|
Of course I tried with #ifndef , but I got error: error C2371: 'SID' : redefinition; different basic types
|
|
|
|
|
This doesn't do what you think it does:
typedef struct_SID {
...
} SID, *PISID
#ifdef SID
typedef struct {
...
}SID;
#endif
#ifdef,#undef etc only refers to preprocessor tokens. In C/C++, you can not undefine (or redefine) a previously defined item. e.g. the following is not valid
int x;
#ifdef x // only if preprocessor token 'x' exists
#undef x // doesn't undefine int x
struct { int i;
double d;
} x;
#endif
...
x myX;
|
|
|
|