Converting std::__cxx11::string to std::string

后端 未结 8 1764
春和景丽
春和景丽 2020-11-22 16:07

I use c++11, but also some libraries that are not configured for it, and need some type conversion. In particular I need a way to convert std::__cxx11::string t

相关标签:
8条回答
  • 2020-11-22 17:07

    Answers here mostly focus on short way to fix it, but if that does not help, I'll give some steps to check, that helped me (Linux only):

    • If the linker errors happen when linking other libraries, build those libs with debug symbols ("-g" GCC flag)
    • List the symbols in the library and grep the symbols that linker complains about (enter the commands in command line):

      nm lib_your_problem_library.a | grep functionNameLinkerComplainsAbout

    • If you got the method signature, proceed to the next step, if you got no symbols instead, mostlikely you stripped off all the symbols from the library and that is why linker can't find them when linking the library. Rebuild the library without stripping ALL the symbols, you can strip debug (strip -S option) symbols if you need.

    • Use a c++ demangler to understand the method signature, for example, this one

    • Compare the method signature in the library that you just got with the one you are using in code (check header file as well), if they are different, use the proper header or the proper library or whatever other way you now know to fix it
    0 讨论(0)
  • 2020-11-22 17:07

    I got this, the only way I found to fix this was to update all of mingw-64 (I did this using pacman on msys2 for your information).

    0 讨论(0)
提交回复
热议问题