json: Error compile Android NDK error: 'strtof' is not a member of 'std'

hi, can you help me, this error occurs when it compile with Android NDK

          error: 'strtof' is not a member of 'std'
         return std::strtof(reinterpret_cast<typename string_t::const_pointer>(m_start), endptr);

         error: 'ERANGE' was not declared in this scope
         if (reinterpret_cast<lexer_char_t*>(endptr) != m_cursor || errno == ERANGE)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 29 (15 by maintainers)

Commits related to this issue

Most upvoted comments

I have no idea why but I needed this instead (this took me a few hours to figure out so hopefully it helps someone on Android using Gradle…):

    externalNativeBuild {
        cmake {
            cppFlags "-fexceptions -frtti -std=c++11"
            arguments "-DANDROID_STL=c++_shared"
        }
    }

I use CrystaX NDK and it compiles all fine for android.

Hi, @nlohmann , I tested the commit PR #222, when I am compiling in Android NDK, this error was solved: error: ‘ERANGE’ was not declared in this scope’‘’ But I have more errores: error: ‘strtof’ is not a member of ‘std’ error: ‘strtoll’ is not a member of ‘std’

I am using the Android NDK configuration, and doesn’t support those function c. Application.MK:

                APP_STL := gnustl_static
                APP_CPPFLAGS :=  -std=c++11 -frtti -fexceptions
                APP_ABI :=  armeabi armeabi-v7a x86 arm64-v8a
                 NDK_TOOLCHAIN_VERSION := 4.9

this commit of the repository #c0bb5a5 work fine for my Android project