[root@localhost dss]# gcc -o abc abc.cpp
/tmp/ccY3hmyr.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
[root@localhost dss]# gcc -o abc abc.cpp -lstdc++

有两种讲法:

1. Linux Develop Notes

* 编译 c++ 程序需要添加 -lstdc++ option. sample: gcc -lstdc++ -o test test
.c,否则会报 "undefined reference to '__gxx_personality_v0' " 错误

2. 唉,用gcc命令编译C程序,用g++命令编译C++程序。

下面是abc.cpp的内容,代码确定无误.

#include <stdio.h>
#include <stdlib.h>
#include <sys/resource.h>
#include <unistd.h>
 
int main(int argc, char *argv[])
{
        struct rlimit rl;
 
        getrlimit(RLIMIT_NOFILE, &rl);
        printf("current open file limit = %1u/n", (long unsigned) rl.rlim_cur);
        printf("current open file max = %1u/n", (long unsigned) rl.rlim_max);
        rl.rlim_cur = RLIM_INFINITY;
        rl.rlim_max = RLIM_INFINITY;
        setrlimit(RLIMIT_NOFILE, &rl);
        printf("current open file limit = %1u/n", (long unsigned) rl.rlim_cur);
        printf("current open file max = %1u/n", (long unsigned) rl.rlim_max);
}

/tmp/ccY3hmyr.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'相关推荐

  1. undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status

    [root@localhost dss]# gcc -o abc abc.cpp /tmp/ccY3hmyr.o(.eh_frame+0x11): undefined reference to `__ ...

  2. undefined reference to '__gxx_personality_v0'

    undefined reference to '__gxx_personality_v0' 编译 c++ 程序需要添加 -lstdc++ option. sample: gcc -lstdc++ -o ...

  3. [CentOS]CentOS下编译CPP文件时报错[undefined reference to `__gxx_personality_v0' collect2: ld]的解决办法...

    在CentOS环境下编译CPP时报出 undefined reference to `__gxx_personality_v0' collect2: ld 以上错误,调查了一下,加上参数[-lstdc ...

  4. 用gcc编译.cpp文件可能出现undefined reference to `__gxx_personality_v0'问题的解决

    用gcc编译.cpp文件时出现错误:undefined reference to `__gxx_personality_v0', 解决的办法就是通过g++来编译,就可以通过了!! 用gcc编译的话需要 ...

  5. pthread_create函数编译时报错:undefined reference to 'pthread_create'

    错误: pthread_create函数编译时报错:undefined reference to 'pthread_create' pthread_create()和pthread_atfork()函 ...

  6. /tmp/ccAceHhY.o: In function `main': main.c:(.text+0xc7): undefined reference to `dlopen' main.c:

    写一些调用dlopen函数的程序,编译的时候总是报: /tmp/ccAceHhY.o: In function `main': main.c:(.text+0xc7): undefined refer ...

  7. linux c 编译报错 Compile error : undefined reference to‘__atomic_fetch_add_4’ 解决方法

    代码如下: #include <opencv2/opencv.hpp> using namespace cv;int main() {Mat img=imread("cornea ...

  8. pow函数gcc编译提示 undefined reference to `power' 的解决办法

    一个程序,用了pow函数,头文件中也包含了<math.h>文件,但是在编译时,gcc -o ippanduan ippanduan.c  一直提示如下错误: /tmp/ccARJLRg.o ...

  9. Linux下undefined reference to ‘pthread_create’问题解决

    Linux下undefined reference to 'pthread_create'问题解决 在试用Linux 线程模块时,试用pthread_create 函数. 编译命令为 gcc main ...

最新文章

  1. rust如何进枪战服_天龙八部怀旧服九大门派详细打造攻略——少林篇
  2. Mysql:一条sql是如何执行的?
  3. JDK12的五大重要新特性
  4. hdu 1561 The more, The Better 树形dp
  5. python单元测试mock_Mock 在 Python 单元测试中的使用
  6. [html] 你知道短链接的生成原理吗?
  7. 360的服务器在哪个文件夹,如何卸载服务器上顽固的360
  8. java 数据源调用_实战分享: Spring boot 调用之间实现动态数据源
  9. seL4操作系统基础05:event interface与seL4Notification connector
  10. 企业数字化转型热潮下,IT技术领导者的10大使命
  11. linux+模块与设备关系,《Linux内核设计与实现》读书笔记 第十七章 设备与模块...
  12. oracle+导入导出教程,oracle导入导出整理(一)
  13. linux上机考试题(Linux基础)
  14. VS2017-Supercharger下载+安装
  15. 电脑版微信多开,只需要三步
  16. kvm虚拟机压缩qcow2镜像空间
  17. Matlab纵向比和横向比,宽度是横向还是纵向-纵向比和横向比-纵向是横向还是竖向...
  18. bat 脚本修改IE浏览器代理服务器
  19. 大数据开发工程师前景如何?
  20. 数据结构 c语言 严蔚敏 第十章 答案 10.1,严蔚敏版数据结构(C语言版)参考答案第十章..doc...

热门文章

  1. Apache 服务的搭建与配置
  2. PMSM中常用的两种坐标变换——Clarke变换
  3. HDU 1166-敌兵布阵
  4. python中的select()以及choose()的用法
  5. JAVA EE 学习路线
  6. EasyDemo*CSS常用形容词总结
  7. 批处理文件命名(简单有效且粗暴!)
  8. Bert和T5的区别
  9. isz的文件怎么打开
  10. Zabbix ODBC方式 数据库监控