问题描述
我在 Visual Studio 2015
中为 Android 创建了一个共享对象.
I have created a shared object for Android in Visual Studio 2015
.
到目前为止它工作正常,但是对于 wstring 的 pop_back()
不起作用:
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 告诉我:在‘std::basic_string<wchar_t>’
中没有名为‘pop_back’的成员".
VS2015 tells me:
"no member named 'pop_back' in 'std::basic_string<wchar_t>'
".
谁能告诉我如何摆脱这个错误?我不知道为什么这不起作用.是不是因为某些原因 VS2015
没有在这里使用 C++11
?
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?
感谢您的帮助!
另一个错误:
当我尝试使用 _wtoi 时,VS 告诉我:使用未声明的标识符 '_wtoi'.非常非常奇怪.
When I try to use _wtoi, VS tells me: "use of undeclared identifier '_wtoi'. Very very strange.
推荐答案
您需要开启 STL 支持.使用 Configuration Properties -> General -> Use of STL 打开 STL.不错的选择是 LLVM libc++ 静态库(功能更少,与 CLANG 更兼容)和 GNU STL 静态库(更多功能,我有一个问题需要我将 CLANG 优化器转换为 -Oz 以防止段错误).
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).