views:

431

answers:

3

We just got a new developer and I'm trying to set him up with Dev Studio 2005 (The version we all use at this office), and we're running into a weird problem that I've never seen before.

I have some code that works perfectly on my system, and he can't seem to get it compiled. We've tracked the issue down to his copy of dev studio ignoring the preprocessor directives.

For example, in the project properties under C/C++|Preprocessor|Preprocessor Directives, I add DEFINE_ME. Which should translate to a /D"DEFINE_ME" for the compiler. And it does in my development environment, but it doesn't on his.

I verified that when he checks out the code from the source repository, that he has the same version of the code I do. And if I look in his Project Properties, all of the directives are there. For some reason they're just not getting passed down to the compiler.

Any Ideas?

+1  A: 

Make sure that the project configuration which is being built in the selected solution configuration is the same as the one you're configuring the properties for, and/or that you're configuring the properties for all project configurations. A common problem with new VS installations is that the current active solution configuration is system-specific, and may default to something not matching yours (eg: Release vs Debug).

You can see the project config in the build output, and/or check it in the Configuration Manager.

Nick
Thanks Nick, I forgot to mention that I did check that. We're trying to just build the Standard Win32 Debug version and we've verified that the build output is the version we're intending to build. And the preprocessor directive are defined (at least according to the property pages) for that config
miked
A: 

Did anyone find the fix for this? I am having the same trouble. My debug configuration is built correctly, but once I switch to the release build, the preprocessor /D is ignored. I did check the configuration for both build, they seem fine. (BTW, this is visual studio 2008)

John Saunders
+1  A: 

I recently ran into the same symptom with VS2005. Ultimately I was able to resolve it by explicitly adding my preprocessor defines via the Command Line - Additional options dialog:

Configuration Properties -> C/C++ -> Command Line

When I added '/DPROPERTY' there it was recognized at compile time, whereas adding it under 'Preprocessor -> Preprocessor Definitions' did nothing. Oddly the Command Line dialog did show that Visual Studio was adding the property to the command line, albeit in the form '/D "PROPERTY"'.

Unfortunately schedule pressure being what it is I have not been able to dig into the issue deep enough to figure out what the underlying issue was/is, nor why it seems to work out of the box for some of our projects but not others. Nonetheless the workaround above is worth a shot if you're having this symptom.

Also, credit where credit is due: the idea came from this thread.

Greg Case