Saturday, January 3, 2009

Don't use defines for string constants in C++part two-linker issues

Well, the saga continues. After replacing a set of constants and enums in one include file
with a C++ class containing the constants and enums we ran into problem number 2.
The constants from include file 1 are used in include file number 2. This results in linker
errors such as the one below. Note the lazy pointers-this is on a Mac.

compile:
[cc] Starting dependency analysis for 1 files.
[cc] 1 files are up to date.
[cc] 0 files to be recompiled from dependency analysis.
[cc] 1 total files to be compiled.
[cc] Starting link
[cc] ld warning: duplicate dylib /usr/lib/libz.1.dylib
[cc] Undefined symbols:
[cc] "NSCLi::CLiTool::CSL_PRINT_IT_FILENANME_", referenced from:
[cc] __ZN5NSCLi7CLiTool23CSL_PRINT_IT_FILENANME_E$non_lazy_ptr in libSupport_Library.a(cslcCLI.o)
[cc] "NSCLi::CLiTool::INFO_", referenced from:
[cc] __ZN5NSCLi7CLiTool5INFO_E$non_lazy_ptr in libSupport_Library.a(cslcCLI.o)
[cc] "NSCLi::CLiTool::CONFIG_FILE_", referenced from:
[cc] __ZN5NSCLi7CLiTool12CONFIG_FILE_E$non_lazy_ptr in libSupport_Library.a(cslcCLI.o)
[cc] "NSCLi::CLiTool::VER_F_", referenced from:
[cc] __ZN5NSCLi7CLiTool6VER_F_E$non_lazy_ptr in libSupport_Library.a(cslcCLI.o)
[cc] "NSCLi::CLiTool::VER_V_", referenced from:
[cc] __ZN5NSCLi7CLiTool6VER_V_E$non_lazy_ptr in libSupport_Library.a(cslcCLI.o)
[cc] "NSCLi::CLiTool::VER_Y_", referenced from:

We need to add the new .o or .a files to the linker command in the ant file.

No comments:

Post a Comment