[DUPLICATE] Trying to build for Android, Qt 5.2.2, GCC 4.8 and C++11

  • Hello... hope this is a simple question...

    I'm trying to build a Qt project (in Qt Creator 3.0.1), with Qt 5.2.2 and android-ndk-r9c. I set <code>CONFIG+=c++11</code>, which didn't supply the needed <code>-std=c++11</code>, so I added <code>QMAKE_CXXFLAGS+=-std=c++11</code>. The existing <code>android-g++/qmake.conf</code> added <code>-std=gnu++0x</code>, so I was ending up the <code>-std=gnu++0x -std=c++11</code>.

    The problem I was seeing was that the compiler wasn't recognizing some C++11 features (specifically <code>shared_ptr</code>). I finally tried a compilation line that looked like this:

    @/Volumes/Projects/android-ndk-r9c/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-g++ -c -pipe -std=c++11 -O0 -g -g -gdwarf-2 -marm -O0 -fno-omit-frame-pointer -Wall -Wno-psabi -W -D_REENTRANT -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../qt5.2.1-android/mkspecs/android-g++ -I../WeightPlates -I../../qt5.2.1-android/include -I../../qt5.2.1-android/include/QtWidgets -I../../qt5.2.1-android/include/QtGui -I../../qt5.2.1-android/include/QtCore -I. -I. -I../../android-ndk-r9c/sources/cxx-stl/gnu-libstdc++/4.8/include -I../../android-ndk-r9c/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -I../../android-ndk-r9c/platforms/android-9/arch-arm/usr/include -I. -o main.o ../WeightPlates/main.cpp@

    This only had <code>-std=c++11</code>, but I still got the same errors, e.g.

    @../WeightPlates/weightplate.h:41:9: error: 'shared_ptr' does not name a type
    typedef shared_ptr<plateDesc> plateDescsp; // shared pointer for plateDesc@

    I'm not sure offhand if I'm using any other C++11 features, and this is the only one I was getting complaints about.

    Does this sound familiar to anyone?

    Thanks for your help...


  • Sorry, I'm such a yutz... I thought this problem sounded familiar, and sure enough I reported it (and found the fix) a while ago: "My previous post":http://qt-project.org/forums/viewthread/31194/

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.