Using -std=c++11 on VS2015

孤人 提交于 2021-02-19 05:56:18

问题


I have created a shared object for Android in Visual Studio 2015.

It works fine so far, but pop_back() for a wstring does not work:

        wstring element = "JustATest!";
        if (element.back() == L'!')
        {
            element.pop_back();
        }

VS2015 tells me: "no member named 'pop_back' in 'std::basic_string<wchar_t>'".

Can anybody tell me how to get rid of this error? I have no idea why this should not work. Is that because for some reason VS2015 does not use C++11 here?

Thank you for the help!

Edit: Another error:

When I try to use _wtoi, VS tells me: "use of undeclared identifier '_wtoi'. Very very strange.


回答1:


You need to turn on STL support. Turn on STL with Configuration Properties -> General -> Use of STL. Good options are LLVM libc++ static library (fewer features, more compatible with CLANG) and GNU STL static library (more features, I had an issue that required me to turn the CLANG optimizer to -Oz to prevent a segfault).



来源:https://stackoverflow.com/questions/30506769/using-std-c11-on-vs2015

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!