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

Jean-Sébastien Guay jean-sebastien.guay at polymtl.ca
Mon Mar 19 08:18:25 EST 2007


Hello Pascal,

> So that in debug mode,
> it produces some functions for the .cpp you were mentioning, and they are
> optimized out in the release build.  Why the linker would see these
> is unclear to me, because on Linux, it would produce a private symbol in the
> object file, hence not visible to other compilation units. On Windows, maybe
> there is no 'private' symbol, so the linker sees it, but then only in debug
> mode.

Just to comment here: The behaviour I saw was _identical_ on Linux and  
Windows (you seem to think otherwise, I just thought I'd make that  
clear). In other words, on both platforms, the code compiled and  
linked in debug mode, and in release (or at least, when NDEBUG was  
defined) the linker complained that those two methods, which were  
defined as inline but not declared as such, were not found.

I haven't experimented with other compilation options (I didn't even  
check to see whether defining NDEBUG in a debug build would reproduce  
the behaviour, and I don't have the code with me right now). But  
anyways, the problem is solved, and I won't make that mistake anymore  
(see below). And since this is a build tool's mailing list, and not a  
compiler mailing list, I think that's the important thing. I may  
experiment more later.

> Anyway, the declaration and definition of these methods are not  
> consistent, so
> that is the real source of the trouble and should be fixed, if you own the
> code.

Indeed it was, and indeed I have.

Thanks,

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