1

<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:

  1. 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.
  2. Application.mk - is bad idea too since lastest studio offers Gradle+CMake. Makefile is too ugly and hard for manual using.
  3. My solution is better.
Community
  • 1
  • 1
kyb
  • 7,233
  • 5
  • 52
  • 105
  • Possible duplicate of [Android ndk std::to\_string support](http://stackoverflow.com/questions/22774009/android-ndk-stdto-string-support) – Oleg Bogdanov Jan 12 '17 at 00:22

1 Answers1

2

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

kyb
  • 7,233
  • 5
  • 52
  • 105