ngrest kyai编译报错:undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char

Posted Dontla

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ngrest kyai编译报错:undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char相关的知识,希望对你有一定的参考价值。

//usr/local/lib/libky_ai_parse_json.a(ky_ai_parse_json.o): In function `nlohmann::detail::serializer<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > > >::dump_escaped(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)':
ky_ai_parse_json.cpp:(.text._ZN8nlohmann6detail10serializerINS_10basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS_14adl_serializerES4_IhSaIhEEEEE12dump_escapedERKSA_b[_ZN8nlohmann6detail10serializerINS_10basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS_14adl_serializerES4_IhSaIhEEEEE12dump_escapedERKSA_b]+0x56c): undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream()'
ky_ai_parse_json.cpp:(.text._ZN8nlohmann6detail10serializerINS_10basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS_14adl_serializerES4_IhSaIhEEEEE12dump_escapedERKSA_b[_ZN8nlohmann6detail10serializerINS_10basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS_14adl_serializerES4_IhSaIhEEEEE12dump_escapedERKSA_b]+0xa44): undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream()'
collect2: error: ld returned 1 exit status
make[2]: *** [deploy/share/ngrest/services/kyai.so] Error 1
make[1]: *** [kyai/CMakeFiles/kyai.dir/all] Error 2
make: *** [all] Error 2

原因:
我的静态库是在ubuntu20.04(9.4.0)上编译生成的,然后放到ubuntu18.04(gcc version 7.5.0)上被链接,编译器版本不一样,所以就报错了!

以上是关于ngrest kyai编译报错:undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char的主要内容,如果未能解决你的问题,请参考以下文章

C++链接报错:which may bind externally can not be used when making a shared object; recompile with -fPIC

C++链接报错:which may bind externally can not be used when making a shared object; recompile with -fPIC

巨坑,cmake make相同的代码居然产生不同的编译结果!见鬼了,ngrest

巨坑,cmake make相同的代码居然产生不同的编译结果!见鬼了,ngrest

linux命令报错:cp: cannot overwrite directory ‘xxx‘ with non-directory(在Linux系统中,同一目录下不能同时存在同名的文件和目录)

C/C++链接静态库报错:dangerous relocation: unsupported relocation(-fPIC)