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

后端 未结 8 1767
春和景丽
春和景丽 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:54

    In my case, I was having a similar problem:

    /usr/bin/ld: Bank.cpp:(.text+0x19c): undefined reference to 'Account::SetBank(std::__cxx11::basic_string, std::allocator >)' collect2: error: ld returned 1 exit status
    

    After some researches, I realized that the problem was being generated by the way that Visual Studio Code was compiling the Bank.cpp file. So, to solve that, I just prompted the follow command in order to compile the c++ file sucessful:

    g++ Bank.cpp Account.cpp -o Bank
    

    With the command above, It was able to linkage correctly the Header, Implementations and Main c++ files.

    OBS: My g++ version: 9.3.0 on Ubuntu 20.04

提交回复
热议问题