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

后端 未结 8 1835
春和景丽
春和景丽 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 16:46

    When I had similar issue it's happened because my lib was build using clang++, and it's linked to libstdc++.so by default on my system. While app binary was build using clang and linked with -lc++ option.

    Easiest way to check dependencies is to perform ldd libName.so

    To fix it you should use the same library on in app and library.

    • Easiest way. Build library using clang++ and compile app using clang++. Without extra linking options on both steps. Default stdlib will be used.

    • Build library with -stdlib=c++ and compile app with -lc++. In this case both library and app will use libc++.so.

    • Build library without extra options and link binary to -lstdc++. In this case both library and app will use libstdc++.so.

提交回复
热议问题