您的位置:首页 > 其它

Clang编译时的问题汇总

2016-07-07 21:58 211 查看
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++库
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  clang编译