undefined reference to `__gxx_personality_v0'

本文详细介绍了在使用makefile文件编译C++项目时遇到的undefined reference to '_gxx_personality_v0'错误,并通过将gcc替换为g++成功解决问题的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天使用makefile文件编译测是一个项目遇到下面的提示信息:
cc -o main test.o main.o
test.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
main.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
make: *** [main.out] 错误 1

下面是我的makefile文件:
 main:test.o main.o
         cc -o main test.o main.o
 main.o test.o:first.h
 main.o:second.h
 clean:
         rm test.o main.o main

解决方法:C++项目使用g++编译而非gcc。。。。。(弱了一次)


                
/usr/bin/ld: summinfo.cpp:(.text._ZN11xlslib_core10hpsf_doc_t7addItemEty[_ZN11xlslib_core10hpsf_doc_t7addItemEty]+0x59): undefined reference to `operator delete(void*)' /usr/bin/ld: ../../src/.libs/libxls.a(summinfo.o):(.rodata._ZTIN11xlslib_core12CSummaryInfoE[_ZTIN11xlslib_core12CSummaryInfoE]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info' /usr/bin/ld: ../../src/.libs/libxls.a(summinfo.o):(.eh_frame+0x13): undefined reference to `__gxx_personality_v0' /usr/bin/ld: ../../src/.libs/libxls.a(colinfo.o): in function `xlslib_core::CColInfo::~CColInfo()': colinfo.cpp:(.text+0x192): undefined reference to `operator delete(void*)' /usr/bin/ld: ../../src/.libs/libxls.a(colinfo.o): in function `__static_initialization_and_destruction_0(int, int)': colinfo.cpp:(.text+0x1bf): undefined reference to `std::ios_base::Init::Init()' /usr/bin/ld: colinfo.cpp:(.text+0x1ce): undefined reference to `std::ios_base::Init::~Init()' /usr/bin/ld: ../../src/.libs/libxls.a(colinfo.o):(.rodata._ZTIN11xlslib_core8CColInfoE[_ZTIN11xlslib_core8CColInfoE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' /usr/bin/ld: ../../src/.libs/libxls.a(colinfo.o):(.eh_frame+0x4b): undefined reference to `__gxx_personality_v0' /usr/bin/ld: ../../src/.libs/libxls.a(continue.o): in function `xlslib_core::CContinue::~CContinue()': continue.cpp:(.text+0x116): undefined reference to `operator delete(void*)' /usr/bin/ld: ../../src/.libs/libxls.a(continue.o): in function `__static_initialization_and_destruction_0(int, int)': continue.cpp:(.text+0x143): undefined reference to `std::ios_base::Init::Init()' /usr/bin/ld: continue.cpp:(.text+0x152): undefined reference to `std::ios_base::Init::~Init()' /usr/bin/ld: ../../src/.libs/libxls.a(continue.o):(.rodata._ZTIN11xlslib_core9CContinueE[_ZTIN11xlslib_core9CContinueE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info' /usr/bin/ld: ../../src/.libs/libxls.a(continue.o):(.eh_frame+0x6b): undefined reference to `__gxx_personality_v0' collect2: error: ld returned 1 exit status make[2]: *** [Makefile:590:testC] 错误 1 make[2]: 离开目录“/home/zhu/桌面/xlslib/xlslib/targets/test” make[1]: *** [Makefile:322:all-recursive] 错误 1 make[1]: 离开目录“/home/zhu/桌面/xlslib/xlslib/targets” make: *** [Makefile:418:all-recursive] 错误 1 make xlslib出现的
03-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值