Including same #define in VS and Linux builds

I have a project that is compiled both under Linux and VS2005 and I need to pass a pack of definitions to C preprocessor during both builds (for example: MY_DEF1=1, MY_DEF2=2 etc.) The definitions are same in both builds.

Is there a way to tell VS2005 to include external build-time definitions?

Answers


In the VS C++ Project properties, there's an entry in:

Configuration Properties | C/C++ | Preprocessor | Preprocessor Definitions

where you can enter the defines (which can differ for each project configuration).


You can use /D compiler option in the project makefile:

/DMY_DEF1=1

http://msdn.microsoft.com/en-us/library/hhzbb5c8.aspx


Need Your Help

Addition not working in c

c printf addition format-specifiers

I was trying c code to add but my program doesn't execute, codeblocks unfortunately closes. What is the error?