tmighty
tmighty

Reputation: 11399

Using -std=c++11 on VS2015

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.

Upvotes: 2

Views: 4075

Answers (1)

Matthew Grivich
Matthew Grivich

Reputation: 451

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).

Upvotes: 1

Related Questions