Clang编译时的问题汇总

1, 
<span style="color:#ff0000;">test.cpp:(.text+0xc): undefined reference to `std::cout'
test.cpp:(.text+0x22): undefined reference to `std::ostream::operator<<(int)'
test.cpp:(.text+0x2a): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
test.cpp:(.text+0x32): undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
test.cpp:(.text+0x4f): undefined reference to `__cxa_allocate_exception'
test.cpp:(.text+0x6e): undefined reference to `std::allocator<char>::allocator()'
test.cpp:(.text+0x82): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
test.cpp:(.text+0x94): undefined reference to `std::runtime_error::runtime_error(std::string const&)'</span>
这是由于clang编译时默认不是标准的c++库,解决的办法就是在clang编译的选项中加上-lstdc++,用来指明clang编译时使用标准的c++库
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值