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
This commit is contained in:
copilot-swe-agent[bot]
2026-03-20 21:21:26 +00:00
parent 8c8cbfa0ba
commit 03b9db782e

View File

@@ -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 <stdio.h>
#include <math.h>
#ifdef __cplusplus
/* Implementation uses C++ features from tinygltf_json.h */
#include <string>
#include <algorithm>
#endif
/* Forward SIMD macros to tinygltf_json.h */
#ifdef TINYGLTF3_JSON_SIMD_SSE2