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

I'm building for Raspberry Pi and have unresolved system symbols

我正在构建一个库 on/for Raspberry Pi,想知道这些丢失的符号在哪里,以及我如何 link 到适当的库。

我用

编译
G++ -pthread -x c++ -std=c++11 ... source   
// note this also with gcc same problem whether g++ or gcc command

和link与

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

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