Mike Weir
Mike Weir

Reputation: 3189

gcc undefined reference between libraries

At linking time, I'm getting the following:

libMain.a(Object.o): In function `Object': 
Object.cpp(44): undefined reference to `Transform::MakeIdentity()'

It is definitely seen from using nm --defined-only libSystem.a

Transform.o:
00000000 T Transform::MakeIdentity()

Both libSystem.a and libMain.a are being input appropriately. Linker command line options:

-o "Game.so" -shared -Wl,-z,noexecstack "-lstdc++" "-lsupc++" "-lgnustl_static" "-lgcc" "libSystem.a" "libMain.a" -nostdlib -l"c" -l"m" -l"log" -l"gcc" -Wl,-soname,"libGame" -Wl,--no-undefined

Upvotes: 1

Views: 3347

Answers (1)

NPE
NPE

Reputation: 500157

The order in which you link static libraries matters. For a detailed discussion, see Why does the order in which libraries are linked sometimes cause errors in GCC?

Upvotes: 4

Related Questions