From fbb83c3b81e7cce24f551fa05283a21ff9054e99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Log=E2=82=90n=20M-?= Date: Sun, 19 Apr 2026 18:11:08 -0500 Subject: [PATCH] Fix overriding of C++11's std::swap function --- nob.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nob.h b/nob.h index 2735a93..73cf02d 100644 --- a/nob.h +++ b/nob.h @@ -3022,6 +3022,12 @@ NOBDEF char *nob_temp_running_executable_path(void) #define nprocs nob_nprocs #define nanos_since_unspecified_epoch nob_nanos_since_unspecified_epoch #define NANOS_PER_SEC NOB_NANOS_PER_SEC + + // On C++, this will cause a failur of compilation if nob.h is included before + // things like `' or `' because of `std::swap' + #if defined(__cplusplus) + #undef swap + #endif #endif // NOB_STRIP_PREFIX #endif // NOB_STRIP_PREFIX_GUARD_