Losing preprocessor defintion after generating first temporary file
From: Sachin Sharma (sachinssharma_at_hotmail.com)
Date: 11/20/04
- Previous message: Steve: "Re: Opening RC file in text mode"
- Next in thread: Sachin Sharma: "Re: Losing preprocessor defintion after generating first temporary file"
- Reply: Sachin Sharma: "Re: Losing preprocessor defintion after generating first temporary file"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 20 Nov 2004 18:30:02 +0530
Hello,
I have a regular DLL using Win32 APIs that I compile with Visual C++.NET
2003. In one of the files, say "d.cpp", I have this code:
#if defined(PRE_ID)
char* pszID = "12345";
#else
char* pszID = NULL;
#endif
Now, I have two release configurations. Same in all other settings, except
that the new configuration contains PRE_ID in Project > Properties > C/C++ >
Preprocessor > Preprocessor Definitions. When I compile the new
configuration, I get char* pszID = NULL and not the other declaration as
expected.
The build log shows that first the compiler creates a temporary files then
compiles a few files, then another temporary file and compiles only
stdafx.cpp. Finally a third temporary file where it compiles our "d.cpp".
The first temporary file shows /D "PRE_ID" as part of the command line but
the second and the third does not.
To confirm this, if I put the above mentioned code in the first file that
compiles as part of the first temporary file then everything works as
expected. So I have a workaround. But why this behavior?
In addition, it is interesting to note that the order of compilation is in
descending order of file names (Z to A) - in this case at least.
Please help.
Regards,
Sachin Sharma
- Previous message: Steve: "Re: Opening RC file in text mode"
- Next in thread: Sachin Sharma: "Re: Losing preprocessor defintion after generating first temporary file"
- Reply: Sachin Sharma: "Re: Losing preprocessor defintion after generating first temporary file"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|