linux 生成动态库时提示relocation R_X86_64_32 against `.rodata' can not be used when making a shared object;

linux生成动态库时遇到了relocation R_X86_64_32 against `.rodata‘ can not be used when making a shared object; recompile with -fPIC错误。

由于我的系统是AMD64位的,所以需要在编译的时候添加 -fPIC选项


解决方法:

例如:

g++ -c -fPIC head.cpp    生成head.o

g++ -fpic -shared -o libfun.so head.o 

linux 生成动态库时提示relocation R_X86_64_32 against `.rodata' can not be used when making a shared object;,布布扣,bubuko.com

文章来自:http://blog.csdn.net/aspnet_lyc/article/details/37604833
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3