[CMake] [resolved] Debug build compiles and links, but Release build fails to link?

Jean-Sébastien Guay jean-sebastien.guay at polymtl.ca
Thu Mar 15 13:50:36 EST 2007


Hello Alan,

> I understood that.  It appeared certain of your needed functions were not
> defined at all.  My guess is a conditional compile is skipping them.

The reason I was so skeptical about -DNDEBUG being the problem was  
that I never used that symbol for any conditional compilation (and I  
mean never - I've seen it used but I prefer to define my own symbols  
so I know what's going on at all times).

The thing is, removing that symbol (removing -DNDEBUG) made things  
compile. And that's not just on Linux where I was trying out CMake,  
but on Windows too, using CMake to generate Visual Studio 2005 project  
files. So I investigated the particular methods that were not being  
found on link, and I noticed that they were defined as inline in the  
.cpp file, but not declared inline in the header file.

Now, again, that seems to work fine in all cases except when NDEBUG is  
defined. I even went back to my old project files and makefiles, added  
-DNDEBUG (on Linux) or /D NDEBUG (on Windows) and the same linker  
errors were generated.

I don't know enough about the intricacies of C++ to know why having a  
method defined as inline but not declared as inline would be a problem  
only triggered by defining NDEBUG, but that isn't too important. At  
least now it's fixed.

Thanks for helping me persist in the NDEBUG direction, Alan.

J-S
-- 
______________________________________________________
Jean-Sebastien Guay     jean-sebastien.guay at polymtl.ca
                         http://whitestar02.webhop.org/

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the CMake mailing list