问题
<string>
is included. What is wrong in std::to_sting(intVar)
?
cppreference. Does it mean CLang does not meet STandarD?
Another question helped, but the answers are not good (for me) because:
- write own std::to_string() is bad idea. Standard is standard. If i write own implementation. I need to wrap it with defines to prevent errors from another compilers/toolchains which does not leak std features. And this impl still leaks full-featured STD.
Application.mk
- is bad idea too since lastest studio offers Gradle+CMake. Makefile is too ugly and hard for manual using.- My solution is better.
回答1:
Does it mean CLang does not meet STandarD?
No, it is because minimal std library set in Android NDK by default.
I use gradle build system:
android {
...
defaultConfig {
...
// This block is different from the one you use to link Gradle
// to your CMake build script.
externalNativeBuild {
cmake {
...
// Use the following syntax when passing arguments to variables:
// arguments "-DVAR_NAME=VALUE"
// ------------------- ANSWER -------------------
arguments "-DANDROID_STL=c++_shared"
}
}
}
buildTypes {...}
// Use this block to link Gradle to your CMake build script.
externalNativeBuild {
cmake {...}
}
}
Read these:
https://developer.android.com/ndk/guides/cmake.html#variables
https://developer.android.com/ndk/guides/cpp-support.htm
来源:https://stackoverflow.com/questions/41603049/error-no-member-named-to-string-in-namespace-std-did-you-mean-tostring