locked
VC++ Ignoring Property Page Preprocessor Definitions RRS feed

  • Question

  • I'm using VS Team Edition, and noticing that the "Preprocessor Definitions" I'm setting on the project property page are being ignored by the compiler, but they are being respected by syntax highlighting.  And yes, when I put a directive into this "Preprocessor Definitions" property, it does show up in the C/C++ property page "Command Line."  In other words, it looks like VC++ recognizes it, and is ready to go, but no luck...

    To make this weirder, if I explicitly insert "Additional options" into the C/C++ property page "Command Line", like this:

    /D "MY_DEFINE"

    ...then it works normally.  But as I said, if that preprocessor directive is placed in the convenient "Preprocessor Directive" property, it doesn't affect the build.

    So then I created a brand new empty C++ project, and tried again to use the property page "Preprocessor Directive" to set "MY_DEFINE".  It works fine in the brand-new project.  I've compared all project settings with the new project and the existing project to find some "telling" difference, but there is none. 

    But bottom line, I can't imagine that there is any kind of solution/project setup called "ignore my preprocessor directive property page values."  Another developer is building the same problematic project(s), using VS2005 Professional.  Same problem.  In fact, every one of our existing projects have this problem, and the problem was present when the solutions were still VS2003 solutions, and persisted when we upgraded to VS2005 solutions. 

    Anyone seen this before?

    Tuesday, August 15, 2006 9:43 PM

Answers

  • I found the problem.

    On the Property Pages of each individual cpp file, someone had added preprocessor symbols (which is ok to do, normally), but had left the "inherit from parent or project defaults" unchecked.  The result was I could define all the symbols I wanted on the project, and each individual file was "explicitly" ignoring it in its settings.

    So what do you know, VC++ does have a "please ignore this" setting...and it hurt (or at least ignorance of it did).

    Tuesday, August 15, 2006 11:08 PM