This problem is related to This question I asked yesterday.
Now it seems that the linker flag --whole-archive forces the test
object to be included in the binary. However, in linking with,
g++ main.cpp -o app -Wl,--whole-archive -L/home/dumindara/intest/test.a -Wl,-no--whole-archive开发者_JAVA技巧
I get the following error:
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: cannot find -lgcc_s
What to do?
.a
files are meant to be statically linked, and so are not compiled with -fPIC
. Consequently, you cannot make a shared library from it.
精彩评论