在链接时,我得到以下内容:
libMain.a(Object.o): In function `Object':
Object.cpp(44): undefined reference to `Transform::MakeIdentity()'
使用nm --defined-only libSystem.a
Transform.o:
00000000 T Transform::MakeIdentity()
正在正确输入libSystem.a和libMain.a。链接器命令行选项:
-o“Game.so”-shared -Wl,-z,noexecstack“-lstdc ++”“ - slupc ++”“ - lgnustl_static”“ - lgcc”“libSystem.a”“libMain.a”-nostdlib -l“ c“-l”m“-l”log“-l”gcc“-Wl,-soname,”libGame“-Wl, - no-undefined
答案 0 :(得分:4)
链接静态库的顺序很重要。有关详细讨论,请参阅Why does the order in which libraries are linked sometimes cause errors in GCC?