freebsd 代码移植时 gcc 相关bug

在将Linux代码移植到FreeBSD时遇到`to_string`未定义的问题,由于FreeBSD的GCC默认未开启C++11支持。解决方案包括使用特定的GCC版本或手动开启C++11支持。此外,运行时链接错误提示需要链接C++运行时库,通过调整编译指令和设置运行时路径来解决。
摘要由CSDN通过智能技术生成

在移植linux代码到 freebsd 系统时,出现各种错误。现将所有错误一一罗列下来,并给出相关的解决方案。

to_string is not a member of std

编辑如下文件 test.cpp

#include <string>
using namespace std;

int main()
{
    string s = std::to_string(42);
    cout << s << endl;
    return 0;
}

编译指令:

gcc -std=c++11 test.cpp test

会报错:

test.cpp: In function 'int main()':
test.cpp:6:18: error: 'to
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值