My clang build is stuck compiling 'C' not C++ ...

57 views
Skip to first unread message

Richard S

unread,
Oct 21, 2023, 10:49:00 AM10/21/23
to android-llvm
I added the switch -std-c++17 to my compiler switches and Android Studio complains that it's not actually building in C++, but rather C.

So what's going on here? How can I ensure that clang on Android is building in C++?

From my CMakeLists.txt file:
target_compile_options(otp PUBLIC -std=c++17 ....)

When I add that I see this pop-up in the IDE:

MyProject.app.main | debug | arm64-v8a error: invalid argument '-std=c++17' not allowed with 'C'

Yi Kong

unread,
Oct 21, 2023, 11:07:29 AM10/21/23
to Richard S, android-llvm
CMake automatically detects language through file extension. If you rename your source file to .CPP, the correct clang should get invoked.

-Yi


--
You received this message because you are subscribed to the Google Groups "android-llvm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-llvm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-llvm/61d106bd-52df-4b8c-837d-cf330b5c0e6an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages