问题
I want some macros having parameters to be available in all files in a project or better a complete solution. In VS2010, if I add them to the Preprocessor Definitions in properties->Configuration Properties->C/C++->Preprocessor using something like
SQUARE(x)=((x)*(x));CUBE(x)=(SQUARE(x)*x);
the macro definitions are not used by the compiler. However the approach may be close since IntelliSense provides the correct definitions when I hover over the macros in the source code.
Is there a way to define the macros and make them visible without including a header with their definitions in every file?
Thanks for any ideas!
回答1:
Place the macro in a file and automatically include it into all files using the /FI option:
https://msdn.microsoft.com/en-us/library/8c5ztk84.aspx
Syntax: /FI[ ]pathname
The /FI option has the same effect as including the file at top of every source file.
来源:https://stackoverflow.com/questions/43242003/options-for-defining-preprocessor-macros-with-parameters-for-entire-project-or-s