我正在/为Raspberry Pi构建一个库,想知道这些缺失符号的位置,以及我如何链接到相应的库。
我用
编译G++ -pthread -x c++ -std=c++11 ... source
// note this also with gcc same problem whether g++ or gcc command
并链接
gcc -pthread -shared -shared-libgcc ... ( objs, libs )
未定义的符号:
undefined reference to `__cxa_end_catch'
undefined reference to `ceil'
undefined reference to `__cxa_guard_release'
undefined reference to `std::allocator<char>::allocator()'
undefined reference to `__dynamic_cast'
undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
undefined reference to `std::string::operator=(char const*)'
undefined reference to `__cxa_begin_catch'
undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
undefined reference to `__cxa_rethrow'
undefined reference to `typeinfo for artd::Thread'
undefined reference to `__cxa_guard_abort'
undefined reference to `__cxa_demangle'
undefined reference to `std::__throw_length_error(char const*)'
undefined reference to `dladdr'
undefined reference to `std::__throw_bad_alloc()'
undefined reference to `std::allocator<char>::~allocator()'
undefined reference to `__cxa_guard_acquire'
collect2: error: ld returned 1 exit status
答案 0 :(得分:1)
您需要使用g ++而不是GCC链接目标文件。 GCC不添加所需的c ++库。