AnsweredAssumed Answered

Preprocessor merges multiple source files causing linking failure

Question asked by sszymczyk on Jun 10, 2016
Latest reply on Jul 15, 2016 by Kader.M

I'm currently doing a "Test Drive" of VisualDSP 5.1.2. I decided to see if it manages to compile a moderately complex templated C++ library and picked Crypto++ library for this test. The library compiled correctly, but when I tried to link it to some test binary I noticed a lot of "Multiply defined symbol" errors. Inspection of saved preprocessor output revealed a very strange behavior - it looks like the preprocessor appends additional source files to the compiled source files and symbols from these additional files were causing mentioned errors. Check for example attached algebra.i file created during compilation of algebra.cpp from Crypto++. At the end of this file you can see that after content from algebra.cpp content from another misc.cpp file is included. Note that misc.cpp is not included anywhere by the project source files but preprocessor appends it anayway to generated output. It also did this with several other files.

 

To isolate the source of the problem I decided to try command-line compilation. The following command:

 

"C:/Program Files/Analog Devices/VisualDSP 5.1.2/ccblkfn.exe" -c++ -eh -rtti  -ED -o algebra.cpp.doj -c algebra.cpp

 

resulted in exactly the same problem - misc.cpp appended after algebra.cpp in generated algebra.i. I would like to know what causes this behavior and how can I disable this.

Attachments

Outcomes