Predefined macros,
Compilers usually provide different predefined macros for compiled programs based on different platforms and compilation options,
For example, Win32 win64 Linux, such as debug and release.
1. When using the GCC/g ++ compiler, you can run the following command to print the macros pre-compiled by the compiler.
Gcc-DM-e-</dev/null
2. For details about vs IDE, see http://msdn.microsoft.com/zh-cn/library/b0084kay.
In addition to the predefined macros, the compiler also allows,Custom macros:
1. When using the GCC/g ++ compiler, add a custom macro by adding the-D option.
Example: G ++-O test-D userm test. cpp
In this way, the userm macro definition is added before the test. cpp is preprocessed.
2. In vs IDE, you can click the properties page of the project, select the C ++ page option, click Preprocessor, and add your own macros to The Preprocessor definitions on the right,
Similarly, a custom macro is added before project preprocessing.
Refer:
Http://jmpcn.bokee.com/5772194.html
Http://msdn.microsoft.com/zh-cn/library/b0084kay
Http://jishudaima.iteye.com/blog/955083
Http://msdn.microsoft.com/en-us/library/y4skk93w (V = vs.80). aspx