未定义的引用`__gxx_personality_v0'用gcc [英] undefined reference to `__gxx_personality_v0' with gcc

查看:673
本文介绍了未定义的引用`__gxx_personality_v0'用gcc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  

可能重复:结果
  什么是__gxx_personality_v0呢?


我已经看到了这个问题,在这里流传着编译C ++ code的范围内。不过我编译的纯粹的C code和不断收到此错误。我被禁止使用-lstdc ++作为一种解决方法这个问题的gcc。如何改变我的code得到它的工作,这是为什么错误弹出了?

我的简化code:

  //这是的main.cpp
#包括LT&;&stdio.h中GT;
诠释的main()
{
    炭CH [3];
    CH [0] = GETC(标准输入);
    CH [1] = GETC(标准输入);
    CH [2] ='\\ 0';
    的printf(%S \\ n,CH);
    返回0;
}

我的编译命令是:

  GCC的main.cpp


解决方案

使用或者 G ++ - 因为你的文件后缀的.cpp 或文件重命名为 .C ,并保持在命令行原样。经测试在Debian 6.0.5与 GCC 4.4.5。

Possible Duplicate:
What is __gxx_personality_v0 for?

I've seen this question circulating around here in the context of compiling C++ code. However I am to compile a pure C code and keep on getting this error. I am forbidden to use "-lstdc++" as a workaround to this gcc problem. How to change my code to get it working and why is this error popping out?

My simplified code:

//this is main.cpp
#include <stdio.h>
int main()
{
    char ch[3];
    ch[0] = getc(stdin);
    ch[1] = getc(stdin);
    ch[2] = '\0';
    printf("%s\n", ch);
    return 0;
}

My compile command is:

gcc main.cpp

解决方案

Use either g++ - since your file is suffixed .cpp or rename the file to .c and keep the command line as is. Tested on Debian 6.0.5 with gcc 4.4.5.

这篇关于未定义的引用`__gxx_personality_v0'用gcc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆