From 7703884ab19cd7ffddc5c52ba57dec82fbc8dc2b Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Mon, 26 Feb 2024 18:06:32 +0000 Subject: [PATCH] Fix MSVC warning C4273 "inconsistent dll linkage" When using CMake, the user can select the MSVC runtime library to be: 1) Statically-linked (with the corresponding `x64-windows-static` vcpkg triplet) or 2) Dynamically-linked (with the corresponding `x64-windows` vcpkg triplet) In the latter case, the compiler emits the C4273 warning. As the "Necessary on some platforms" comment does not apply to MSVC, skip the declaration for MSVC. --- src/randomenv.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/randomenv.cpp b/src/randomenv.cpp index 93d30a27fd..4754b597c5 100644 --- a/src/randomenv.cpp +++ b/src/randomenv.cpp @@ -58,7 +58,9 @@ #include #endif +#ifndef _MSC_VER extern char** environ; // NOLINT(readability-redundant-declaration): Necessary on some platforms +#endif namespace {