Compiling Android project with C++20 and Qt 6.5.8
-
@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? -
It fails with
Fatal error: 'numbers' file not found #include <numbers>
-
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?
-
Yes. The project with its C++20 features works on others systems, as well as Qt 6.8.1 for Android but fails with 6.5.x. I cannot use Qt 6.8.1 because there is has a bug which has been fixed in Qt 6.8.2.
-
@hamer But did you verify that C++20 is enabled when you build with 6.5.x? You should enabled it explicitly.
-
How can I verify it? My CMakeLists.txt has these lines:
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON)
-
@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
-
@hamer Where is this numbers header included?
11/11