您的位置:首页 > 编程语言 > C语言/C++

Use g++ to replace gcc when link the .cpp file

2014-03-25 13:11 295 查看
Use g++ to replace gcc when link the .cpp file

Q:

I have a small program, test.c. It runs OK. This is on Linux (kernel

2.6.8.1, GCC 3.4.1).

I decided to convert it to C++ before expanding it to a larger program. I

changed the filename to test.cpp and added

extern "C" {

}

around main and all the non-static subroutines. It compiles OK, but when I

link it, it says:

test.o (.eh_frame+0x11): undefined reference to '__gxx_personality_v0'

A:

use g++ to link
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux c++
相关文章推荐