[Cmake] Windows Linking Errors

Chris Scharver scharver at evl . uic . edu
Fri, 7 Nov 2003 09:02:06 -0600


Hello,

I am trying to move a large Visual Studio project over to CMake. The 
setup builds fine on MacOS X and Linux systems using the same source 
libraries. However, compiling on Windows with the CMake-generated .dsp 
everything goes haywire. Everything compiles fine, but there are 
numerous linking errors that don't occur when using the Visual 
Studio-built .dsp.

There errors are for a single multiply-defined symbol. The symbol is 
declared as an inline friend in a header file. This shouldn't be a 
problem. However, VC++ (6 with service pack 5) chokes. I get several 
errors of the form:

CrDefectTool.obj : error LNK2005: "int __cdecl operator!=(class 
SbString const &,class SbString const &)" (??9 at YAHABVSbString@@0 at Z) 
already defined in CrControllerObserver.obj

My CMake file is pretty basic. All the libraries are MDd, and I just 
add these using nothing more than ADD_EXECUTABLE and 
TARGET_LINK_LIBRARIES. I am using CMake 1.8.1, so is there some kind of 
known conflict when dealing with inline functions? It's as if the 
compiler is defining the symbol for every object file and cannot 
resolve them when performing the final link for the executable. Any 
ideas?

Thanks,
Chris

--
Chris Scharver
Electronic Visualization Laboratory
The University of Illinois at Chicago
Ph: 312-996-3002   FAX: 312-413-7585
<http://www . evl . uic . edu/scharver/>