Compiling Android project with C++20 and Qt 6.5.8
-
Hi,
I have a Qt project which uses c++20 features ("numers", "source_location", etc.) which I want to compile with Qt 6.5.8 for Android but this always fails (using NDK 25.x). The same project works fine with Qt 6.8.1 for Android or Qt 6.5.8 for iOS/Windows.
Is Qt 6.5.8 for Android not compatible with C++20?
Regards,
-
@hamer said in Compiling Android project with C++20 and Qt 6.5.8:
Is Qt 6.5.8 for Android not compatible with C++20?
I don't think so.
What errors do you get? -
When I set ANDROID_NDK to "28.0.12916984" then I get errors like these:
In file included from C:/Android/ndk/28.0.12916984/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1/optional:180: In file included from C:/Android/ndk/28.0.12916984/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1/__assert:13: In file included from C:/Android/ndk/28.0.12916984/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1/__assertion_handler:14: C:/Android/ndk/28.0.12916984/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1/__verbose_abort:20:1: error: expected expression C:/Android/ndk/28.0.12916984/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include/c++/v1/__config:866:32: note: expanded from macro '_LIBCPP_BEGIN_NAMESPACE_STD' inline namespace _LIBCPP_ABI_NAMESPACE { ^
But it seems as if NDK 25 and 28 are mixed (although I have set ANDROID_NDK and CMAKE_TOOLCHAIN_FILE to NDK 28).
-
@hamer said in Compiling Android project with C++20 and Qt 6.5.8:
<numbers>
This requires C++20 - did you enable C++20?
-
@hamer said in Compiling Android project with C++20 and Qt 6.5.8:
How can I verify it?
By looking at the build log to see what parameter were passed to the compiler.
-
The logs show c++20:
C:/QtCommercial/6.5.8/android_arm64_v8a/include -isystem C:/QtCommercial/6.5.8/android_arm64_v8a/include/QtCore -isystem C:/QtCommercial/6.5.8/android_arm64_v8a/mkspecs/android-clang -isystem C:/QtCommercial/6.5.8/android_arm64_v8a/include/QtGui -isystem C:/QtCommercial/6.5.8/android_arm64_v8a/include/QtNetwork -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fexceptions -frtti -stdlib=libc++ -O3 -DNDEBUG -std=c++20 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fno-rtti -Wall -Wshadow -Wextra -Wno-error=tautological-constant-compare -pthread