undefined reference cross compiling static libraries with LTO under GCC

跟風遠走 提交于 2019-12-01 16:53:01

I'm able to reproduce this linking problem on Mingw32-gcc 4.9.2 under Win7 64-bit. However, I did get it to link successfully by adding -ffat-lto-objects as a workaround:

g++ -flto -o foo.o -c foo.cpp
g++ -flto -ffat-lto-objects -o bar.o -c bar.cpp
ar rc bar.a bar.o
g++ -flto -o foo.exe foo.o bar.a
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!