I have a C ++ library and a C ++ application trying to use functions and classes exported from a library. The library builds fine and the application compiles but does not link. The errors I get follow this form:
app-source-file.cpp :(. text + 0x2fdb): undefined reference to `lib-namespace :: GetStatusStr (int) '
The classes in the library seem to be very well versed in the linker, but free functions and exported data (such as the cosine lookup table) invariably lead to the above error.
I use Ubuntu 8.04 (Hardy) and it is updated with the latest Unbuntu packages.
The command to link the library (with the removal of other libraries):
g++ -fPIC -Wall -O3 -shared -Wl,-soname,lib-in-question.so -o ~/project/lib/release/lib-in-question.so
The command to connect the application (with the removal of other libraries):
g++ -fPIC -Wall -O3 -L~/project/lib/release -llib-in-question -o ~/project/release/app-in-question
Finally, it appears (as far as I can tell) that the corresponding characters are exported correctly:
nm -D ~/project/lib/release/lib-in-question.so | grep GetStatusStr --> U _ZN3lib-namespace12GetStatusStrEi
source
share