I am trying to add a preprocessor definition so that a value is only defined while a certain project is building, then it becomes undefined. I have gone into my project properties -> preprocessor -> preprocessor definitions. In here, I typed
#define PROJECTNAME_EXPORT, in hopes that I could call
#ifdef PROJECTNAME_EXPORT throughout that project to swap out a value (between dllexport and dllimport) on build-time.
However, when I hit okay, it looks like visual studio adds a double quote before my definition. When I try to build, I get over 100 errors, mostly saying "illegal escape sequence". Others of note are "int define: redefinition", "int MYPROJECT_EXPORT redefinition", etc. Have I done something wrong?
You don't include the "
#define" in the definition. Just the name of the symbol, and optionally a value, like so:
The way to think of the definitions you enter here, into the IDE, is that they will be passed to the compiler using the /D option, so the syntax ought to be close. There would be no need to include the
#definesyntax, since these definitions are handed to the compiler/preprocessor not in C source, but through a different mechanism.