No c++11 support for Android

88 views
Skip to first unread message

JaTe

unread,
Mar 21, 2018, 9:39:12 AM3/21/18
to android-qt
I'm building an Android app in qt and need c++11 support for a 3rd party library.

The app builds fine with my desktop kit (MinGW 5.3.0) but I get multiple errors for my Android kit, like:

'to_string' is not a member of 'std'
'strtof' ist not a member of 'std'
etc.

My android kit (auto detected):
Android for armeabi-v7a (GCC 4.9, Qt 5.10.0 for Android armv7)
Compiler: Android GCC (C, arm-4.9)
Compiler: Android GCC (c++, arm-4.9)

NDK Version: r10e

I've already tried to add these flags to the pro file: 

CONFIG += c++11
QMAKE_CXXFLAGS += -std=c++11
QMAKE_LFLAGS +=  -std=c++11


The common solution seems to be adding
 
APP_STL:=c++_static

to your Android.mk file, but as far as I know that doesn't exist when using qt. 

These are my CXXFLAGS from the build directory make file:

CXXFLAGS      = -D__ANDROID_API__=16 --sysroot=C:\Android\NDK\android-ndk-r10e/platforms/android-16/arch-arm/ -isystem C:\Android\NDK\android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem C:\Android\NDK\android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -std=c++11 -g -g -marm -O0 **-std=gnu++11** -Wall -W -D_REENTRANT -fPIC $(DEFINES)

BogDan Vatra

unread,
Mar 21, 2018, 2:00:11 PM3/21/18
to android-qt
Hi,

Sadly C++11 is incomplete in Android's GNU stl implementation.
You'll either need to replace the missing pieces with Qt api, or rebuild entire Qt with clang.

BogDan.
> --
> You received this message because you are subscribed to the Google Groups
> "android-qt" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to android-qt+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

JaTe

unread,
Mar 23, 2018, 7:40:49 AM3/23/18
to android-qt
Hi, 

thanks a lot for the quick support.

And with qt I can't just switch to another stl? I've read that the library I'm trying to use should work when the NDK is using APP_STL=c++_static.   

Sorry if I'm asking stupid questions, I'm not really great with toolchains.

BogDan Vatra

unread,
Mar 23, 2018, 8:23:37 AM3/23/18
to android-qt
Hi,

No, you can't. You must rebuild Qt.

BogDan.
Reply all
Reply to author
Forward
0 new messages