开发者

Linking with --whole-archive flag

开发者 https://www.devze.com 2023-01-19 00:17 出处:网络
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,

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消