我正在为Raspberry Pi构建并且有未解析的系统符号

时间:2017-12-28 05:10:56

标签: c++ gcc raspberry-pi3

我正在/为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

1 个答案:

答案 0 :(得分:1)

您需要使用g ++而不是GCC链接目标文件。 GCC不添加所需的c ++库。