Skip to content

Commit fff4689

Browse files
committed
Disable warning when building monster_test_cpp (clang-20)
monster.c:294:5: warning: 'main' should not be 'extern "C"' [-Wmain] 294 | int main(int argc, char *argv[]) | ^ Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
1 parent a3cd335 commit fff4689

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/monster_test_cpp/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
include(CTest)
22

33
# Note: This re-uses the samples/monster fbs and .c file.
4+
# According to the C++ standard Section 6.9.3.1 of ISO/IEC 14882:2024
5+
# "an entity named main with C language linkage (in any namespace) is ill-formed"
6+
# Let's disable the warning from Clang that we include main() using extern "C".
7+
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
8+
add_compile_options(-Wno-main)
9+
endif()
410

511
set(INC_DIR "${PROJECT_SOURCE_DIR}/include")
612
# We use our own separate gen dir so we don't clash with the real monster sample.

0 commit comments

Comments
 (0)