错误 undefined reference to __cxa_guard_acquire/release

用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编译参数即可。

时间: 2024-12-15 17:42:20

错误 undefined reference to __cxa_guard_acquire/release的相关文章

解决错误 undefined reference to symbol '[email protected]@CXXABI_1.3.8'

1. 错误信息 在Makefile里,定义CC为"aarch64-linux-gnu-g++ --sysroot=$(MPSOC_ROOTFS)",编译test.cpp,没有错误.如果使用environment-setup-aarch64-xilinx-linux里的设置,在Makefile里不定义CC,编译test.cpp出现下列错误. [email protected]:/proj/hankf/zcu106/v183/egl$ make aarch64-xilinx-linux-g

【翻译自mos文章】在RHEL7或者OL7上安装11.2.0.4时遇到错误 “undefined reference to symbol ‘B_DestroyKeyObject’”

来源于: Installation of Oracle 11.2.0.4 on OL7 fails with "undefined reference to symbol 'B_DestroyKeyObject'" error (文档 ID 1965691.1) 适用于: Oracle Database - Enterprise Edition - Version 11.2.0.4 to 11.2.0.4 [Release 11.2] Oracle Database - Standar

Android编译错误——undefined reference to

[错误描述] 未定义引用 提示如下:bootable/recovery/minzip/Zip.c:1122: error: undefined reference to 'selabel_lookup'bootable/recovery/minzip/Zip.c:1123: error: undefined reference to 'setfscreatecon'bootable/recovery/minzip/Zip.c:1129: error: undefined reference to

cocos2dx添加新的类后出现错误undefined reference to的解决办法

使用cocos compile -p android编译cocos2dx项目的时候出现如下错误(新建了TestScene.h,TestScene.cpp): jni/../../Classes/AppDelegate.cpp:79: error: undefined reference to 'TestScene::createScene()' clang++.exe: error: linker command failed with exit code 1 (use -v to see in

「caffe编译bug」.build_release/lib/libcaffe.so: undefined reference to cv::imread

转自:https://www.douban.com/note/568788483/ CXX/LD -o .build_release/tools/convert_imageset.bin.build_release/lib/libcaffe.so: undefined reference to cv::imread(cv::String const&, int)' .build_release/lib/libcaffe.so: undefined reference tocv::imencode

GCC编译uboot出现(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'错误的解决办法

/opt/arm-2010.09/bin/../lib/gcc/arm-none-linux-gnueabi/4.5.1/armv4t/libgcc.a(_bswapsi2.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0' make: *** [u-boot] Error 1 一旦编译uboot出现上述错误,请不要慌张!解决办法官网已经给出,主要解决办法如下: vim 打开./lib_arm/eabi_com

在做nios ii uart232 实验时出现undefined reference to `fclose'等错误。

程序如下 #include<stdio.h> #include<string.h> #include "system.h" int main () { char* msg = "Detected the character 't'.\n"; FILE* fp; char prompt = 0; printf("Please Enter some characters: \n"); fp = fopen ("/de

gcc参数-l传递顺序错误导致`undefined reference&#39;的一点小结

刚才编译一个pthread的单文件程序, 使用的命令行是: gcc -o thread1 -lpthread thread1.c 结果报错: 1 $ gcc -o thread1 -lpthread thread1.c 2 /tmp/ccNqs6Bh.o: In function `main': 3 thread1.c:(.text+0x49): undefined reference to `pthread_create' 4 thread1.c:(.text+0x5f): undefined

由于link顺序错误导致的undefined reference

其实我之前就遇到过这个问题,也强调过,GNU-G++在link阶段是依赖输入的.o或者.a文件的顺序的.如果顺序错误会导致undefined reference错误 见这篇随笔:http://www.cnblogs.com/qrlozte/p/4137704.html 刚才我遇到的问题是什么呢? 代码demo.cpp:其中ZJ::open_max在util.h中声明,在$(PATH_ONE)/libutil.a中:err_sys在apue.h中声明,在$(PATH_TWO)/libapue.a中