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

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

  1. [转载]解决linux 下多线程错误 undefined reference to `sem_init'

    转自:https://blog.csdn.net/yzycqu/article/details/7396498?utm_source=copy 解决linux 下多线程错误 undefined ref ...

  2. 解决错误---undefined reference to `pthread_create‘

    今天试着敲了一下APUE的小例子,遇到了个错误 -----  undefined reference to `pthread_create.(为自己这么晚接触多线程惭愧). 上网上查了一下,借人经验. ...

  3. Android编译错误——undefined reference to

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

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

    使用cocos compile -p android编译cocos2dx项目的时候出现如下错误(新建了TestScene.h,TestScene.cpp): jni/../../Classes/App ...

  5. eclipse中编译出现错误undefined reference to `_sbrk'

    1. 在eclipse中使用gcc-arm-none-eabi-7-2017-q4-major-win32编译代码的时候出现了undefined reference to `_sbrk' e:/pro ...

  6. 编译3.10内核 出现错误 “undefined reference to...." 解决方法

    向内核中加入C文件后.假设想编译进内核须要改动当前文件夹下的Kconfig文件和Makefile文件. 如:加入一个test.c文件到driver文件夹下,则须要改动Kconfig文件: config ...

  7. undefined reference to `switch_dev_unregister'

    编译内核时,使用默认的配置进行编译.出现错误:undefined reference to switch_dev_unregister',undefined reference toswitch_se ...

  8. 「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_ ...

  9. undefined reference to `BN_new'

    出现如下错误 undefined reference to `BN_CTX_new' undefined reference to `BN_new' undefined reference to `B ...

随机推荐

  1. 【leetcode❤python】342. Power of Four

    #-*- coding: UTF-8 -*- class Solution(object):    def isPowerOfFour(self, num):        ""& ...

  2. BZOJ 1050 旅行comf(枚举最小边-并查集)

    题目链接:http://61.187.179.132/JudgeOnline/problem.php?id=1050 题意:给出一个带权图.求一条s到t的路径使得这条路径上最大最小边的比值最小? 思路 ...

  3. Linux 新手非常有用的命令

    http://www.cnblogs.com/felix-/p/4341773.html Linux 新手非常有用的命令 你打算从Windows换到Linux上来,还是你刚好换到Linux上来?哎哟! ...

  4. JaveScript变量作用域说明

    JaveScript变量作用域说明     一:将var类型的变量视为变量,不带var类型的变量视为常量(但是注意php的常量不可以重新定义,而javascript中不带var类型的变量可以重新定义) ...

  5. excel在一个图表内,显示折线图和柱状图

      折线图和柱状图,在同一个图表中拆分显示   一个图,设置主坐标轴 另外一个图,设置次坐标轴     拆分,通过调整纵坐标的最小值和最大值来实现     关于图表的标题,选中图表,选择布局,然后图表 ...

  6. 字符串表达式String Expressions

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  7. NSValue

    1.利用NSValue包装自定义的结构体    typedef struct{        int age;        char *name;        double height;    ...

  8. poj 2318 TOYS (二分+叉积)

    http://poj.org/problem?id=2318 TOYS Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 101 ...

  9. Python入门-引号

    Python 接收单引号(' ),双引号(" ),三引号(''' """) 来表示字符串,引号的开始与结束必须的相同类型的. 其中三引号可以由多行组成,编写多行 ...

  10. python_way day11 自定义线程池

    python_way day11 线程池 为什么需要线程池 线程多一些固然好,但是过多的线程反倒影响系统的负荷,所以我们就需要创建合适多的线程,哪我们把线程放到哪里?这时就放到线程池中. 线程池中存放 ...