Compiler definitions of source code linked to lib change lib?
I have file A.cpp that has targetlibs=Lib.lib on the sources file. Lib.cpp was compiled with C_defines=-DS开发者_开发百科omething, but A.cpp is compiled with C_defines=-DOther. Lib.pp contains #ifdefs for -DSomething and -DOther.
What happens in this case? Is -DSomething kept or replaced by -DOther? Is -DOther ignored? Or both are kept? Thanks
Defines have an effect at compile time, so -DSomething is kept for the library code and -DOther for the program code. Be careful, if a header of Lib , eg Lib.h , is included in A.cpp,-DOther is used for the header code as well, since it is in the same compilation unit as A.cpp.
精彩评论