问题
My executable is linked against several libraries (see below), but at run-time crashes with this error:
symbol lookup error: bin.gcc/TestHarmonic: undefined symbol: _ZN3fmm8harmonic7details6helperILi2ENS0_6U_typeEdE5set_qEPdPKddd
The executable is made using (on linux, running gcc 4.8.1)
g++ -o bin.gcc/TestHarmonic obj.gcc/TestHarmonic.o -Llib/ -lfmm.gcc -Lutils2/lib -lWDutils2.gcc -ltbb -lCGAL -lm
The symbol in question is actually where it ought to be:
nm lib/libfmm.gcc.so | grep _ZN3fmm8harmonic7details6helperILi2ENS0_6U_typeEdE5set_qEPdPKddd
000000000a2fff0 W _ZN3fmm8harmonic7details6helperILi2ENS0_6U_typeEdE5set_qEPdPKddd
The library lib/libfmm.gcc.so is made via
g++ several_files.o -shared -Lutils2/lib -lWDutils2.gcc -ltbb -lCGAL -lm -o lib/libfmm.gcc.so
If I delete that but keep a static version lib/libfmm.gcc.a and build the executable again, it works. What could be wrong here and how can I fix this?
来源:https://stackoverflow.com/questions/26127502/symbol-lookup-error-despite-the-symbol-being-present-in-linked-library