1

Since Qt 5.7, C++11 support is mandatory. For some reason one large old project does not accept the C++11 arguments. It doesn't matter if I use "CONFIG += c++11" or any other; C++11 only features do not work and therefor I can not compile the project.

C:\QtE\5.7\android_armv7\include\QtCore\qbasicatomic.h:61: error: error "Qt requires C++11 support" ^

The compiler arguments do contain "-std=c++11 -std=c++0x" if I use "CONFIG += c++11" in the .pro file. The target platform is Android ArmV7. SDK R24 and NDK R10E are used.

C:\SDKs\Android\android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/windows/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -fno-builtin-memmove -std=c++11 -fPIC -ansi -fpermissive -finline-functions -Wno-long-long -g -g -marm -O0 -fno-omit-frame-pointer -O2 -Wall -Wno-psabi -W -D_REENTRANT -fPIC -DPJ_IS_LITTLE_ENDIAN=1 -DPJ_IS_BIG_ENDIAN=0 -DQZXING_LIBRARY -DZXING_ICONV_CONST -DDISABLE_LIBRARY_FEATURES -DNOFMAXL -DBOTAN_DLL=Q_DECL_EXPORT -DBOTAN_TARGET_OS_HAS_GETTIMEOFDAY -DBOTAN_HAS_ALLOC_MMAP -DBOTAN_HAS_ENTROPY_SRC_DEV_RANDOM -DBOTAN_HAS_ENTROPY_SRC_EGD -DBOTAN_HAS_ENTROPY_SRC_FTW -DBOTAN_HAS_ENTROPY_SRC_UNIX -DBOTAN_HAS_MUTEX_PTHREAD -DBOTAN_HAS_PIPE_UNIXFD_IO -DBOTAN_TARGET_OS_IS_LINUX -DBOTAN_TARGET_OS_HAS_CLOCK_GETTIME -DBOTAN_TARGET_OS_HAS_DLOPEN -DBOTAN_TARGET_OS_HAS_GMTIME_R -DBOTAN_TARGET_OS_HAS_POSIX_MLOCK -DBOTAN_HAS_DYNAMICALLY_LOADED_ENGINE -DBOTAN_HAS_DYNAMIC_LOADER -DBOTAN_BUILD_COMPILER_IS_GCC -DQT_QML_DEBUG -DQT_QUICKWIDGETS_LIB -DQT_WIDGETS_LIB -DQT_QUICK_LIB -DQT_MULTIMEDIA_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_WEBSOCKETS_LIB -DQT_NETWORK_LIB -DQT_POSITIONING_LIB -DQT_ANDROIDEXTRAS_LIB -DQT_CORE_LIB

Any idea is welcome :)

metaDom
  • 43
  • 6

2 Answers2

1

According to this questions accepted answer, It says CONFIG += c++11 requires Qt 5. Are you sure you are using Qt 5?

Also, It also says if you use gcc/clang you should use QMAKE_CXXFLAGS += -std=c++11 (or QMAKE_CXXFLAGS += -std=c++0x).

since you are building an android project, it will use gcc. Change CONFIG += c++11 to QMAKE_CXXFLAGS += -std=c++11 and tell me what happened.

Community
  • 1
  • 1
  • Sure I'm using Qt5. Same error with "QMAKE_CXXFLAGS += -std=c++11" and "QMAKE_CXXFLAGS += -std=c++0x". All results in "C:\QtE\5.7\android_armv7\include/QtCore/qbasicatomic.h:61:4: error: #error "Qt requires C++11 support"" – metaDom Jun 29 '16 at 13:47
  • Then What version do you have exactly? –  Jun 29 '16 at 13:48
  • Would you try adding `QMAKE_LFLAGS += -std=c++11`? –  Jun 29 '16 at 13:49
  • or changing `QMAKE_CXXFLAGS += -std=c++11` to `gcc:QMAKE_CXXFLAGS += -std=c++11`. –  Jun 29 '16 at 13:52
  • Hey, sorry for late answer. Tried em' all, same result "Qt requires C++11 support" – metaDom Jul 04 '16 at 07:49
  • @metaDom Okay. Tell me when you found the solution. :) –  Jul 04 '16 at 08:25
1

One of the .pri sub-projects used the argument "-ansi" which is equivalent to "-std=c++98". This prevents the compilation with C++11.

Thanks to Oktalist for the solution comment :)

metaDom
  • 43
  • 6