用gcc编译 c++ 程序时,出现错误 undefined reference to __cxa_guard_acquire linker error, 但是用icc可以正常编译, 问题出在static 上。从网上搜到的解决办法是加库的链接:
To resolve this undefined references (__cxa_guard_acquire ) , add a library flag "-lstdc++" in your Makefile. It should work. It worked for me.
(http://rowley.zendesk.com/entries/46190-undefined-reference-to-cxa-guard-acquire-error-message)
加上后工作正常。
转自http://blog.sina.com.cn/s/blog_607233f50100xlml.html
在 gcc编译语句后添加-lstdc++即可。
如果出现其他未定义声明的情况:
undefined reference to `XXX'
collect2: ld returned 1 exit status
同理添加-lxxx编译参数即可。
undefined reference to ‘pthread_create’:
添加-lpthread编译参数即可
原文链接: https://www.cnblogs.com/LarryGen/p/5285920.html
欢迎关注
微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍
原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/230327
非原创文章文中已经注明原地址,如有侵权,联系删除
关注公众号【高性能架构探索】,第一时间获取最新文章
转载文章受原作者版权保护。转载请注明原作者出处!