开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜