Compiler definitions of source code linked to lib change lib?

41 views Asked by At

I have file A.cpp that has targetlibs=Lib.lib on the sources file. Lib.cpp was compiled with C_defines=-DSomething, 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

1

There are 1 answers

0
manol On BEST ANSWER

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.