使用gcc 4.6尝试执行此代码时:
#include <iostream>
using namespace std;
#include <bitset>
int main()
{
//Int<> a;
long long min = std::numeric_limits<int>::min();
unsigned long long max = std::numeric_limits<int>::max();
cout << "min: " << min << '\n';
cout << "max: " << max << '\n';
cout << (min <= max);
std::bitset<64> minimal(min);
cout << "minimal: " << minimal;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
1.未定义引用__gxx_personality_sj
2.未定义引用_Unwind_SjLj_Register
3. undefined引用_Unwind_SjLj_Unregister
4. undefined引用_Unwind_SjLj_Resume
到底是怎么回事?!
可能重复:
fedora上的gcc链接器错误:未定义的引用
由于我遇到了VC++的问题(gcc不会发生函数重载,因为我的项目合作伙伴是在Linux上编程),我在cygwin上切换到了gcc,但是我也无法在这里运行程序(他能够编译相同的代码而没有任何问题)
我正在尝试编译
$ gcc -I D:/Programme/Boost_Library/boost_1_51 ABI_new.cpp -o ABI
Run Code Online (Sandbox Code Playgroud)
之后我收到了大量的错误:
/tmp/ccO4eSA2.o:ABI_new.cpp:(.text+0xd): undefined reference to ´std::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const'
/tmp/ccO4eSA2.o:ABI_new.cpp:(.text+0x60): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator[](unsigned int) const'
/tmp/ccO4eSA2.o:ABI_new.cpp:(.text+0x9f): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator[](unsigned int) const'
/tmp/ccO4eSA2.o:ABI_new.cpp:(.text+0xce): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator[](unsigned int) const'
Run Code Online (Sandbox Code Playgroud)
我不确定这是否必须对程序显然无法读取输入文件(由退出状态指示)做任何事情,但我不知道,为什么这也不起作用,因为 - 再次 - 我的同事对完全相同的代码没有任何问题.
我真的很感激任何tipps.