gcc新旧版本ABI在项目中兼容性问题

GCC 5.1版本后引入了新的ABI,导致libstdc++中的string和list函数签名改变,可能引发兼容性问题。当升级GCC到5.1及以上并使用C++11标准时,可能会遇到第三方库的ABI不匹配,表现为undefined symbol错误。解决方案包括使用旧版本ABI编译项目、修改第三方库源码、寻找支持新ABI的新版本库或创建中间代理库。

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

ABI

这里与我们常用的API的概念一起拿出来对比认识。
API全称:Application Program Interface

An API defines the interfaces by which one piece of software communicates with another at the source level.

ABI全称:Application Binary Interface

Whereas an API defines a source interface, an ABI defines the low-level binary interface between two or more pieces of software on a particular architecture. It defines how an application interacts with itself, how an application interacts with the kernel, and how an application interacts with libraries.

可以参考这个链接difference-between-api-and-abi

兼容性问题

由于在gcc5.1版本中,libstdc++库中使用了新版本的底层string和list,为了与原有方式兼容,引入了新版本的ABI。即是gcc5.1之后,默认含有string类型的函数,其函数签名不一样。
例如:void Get(std::string str);
旧版本ABI的函数签名为:
_Z3GetSs
使用c+

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值