ld
将不再在链接目标的依赖中自动搜索。
A
和B
两个库都用的话,那么只有在A
和 B
都明确的链接后才能编译。
/usr/bin/ld: gpx-parser.o: undefined reference to symbol 'acos@@GLIBC_2.0' /usr/bin/ld: note: 'acos@@GLIBC_2.0' is defined in DSO /lib/libm.so.6 so try adding it to the linker command line
.o
的行需要明确地链接libm。