From 03b9db782ee74ee31d603be84bd6baeca1465ad4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Mar 2026 21:21:26 +0000 Subject: [PATCH] Add C++ compilation guard for TINYGLTF3_IMPLEMENTATION Co-authored-by: syoyo <18676+syoyo@users.noreply.github.com> Agent-Logs-Url: https://github.com/syoyo/tinygltf/sessions/9d34bfe8-6b91-44f8-aedc-adb3bfeadf84 --- tiny_gltf_v3.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tiny_gltf_v3.h b/tiny_gltf_v3.h index 931af22..a32b313 100644 --- a/tiny_gltf_v3.h +++ b/tiny_gltf_v3.h @@ -47,7 +47,7 @@ * Section 2: Configuration Macros * ====================================================================== */ -/* Build mode: define in ONE .c/.cpp translation unit */ +/* Build mode: define in ONE C++ translation unit (.cpp) */ /* #define TINYGLTF3_IMPLEMENTATION */ /* Opt-in features (OFF by default) */ @@ -1221,17 +1221,19 @@ ParseGenerator tg3_parse_coro( #ifdef TINYGLTF3_IMPLEMENTATION +#if !defined(__cplusplus) +#error "TINYGLTF3_IMPLEMENTATION requires a C++ translation unit (compile as .cpp)" +#endif + /* Include JSON parser */ #include "tinygltf_json.h" #include #include -#ifdef __cplusplus /* Implementation uses C++ features from tinygltf_json.h */ #include #include -#endif /* Forward SIMD macros to tinygltf_json.h */ #ifdef TINYGLTF3_JSON_SIMD_SSE2