diff --git a/src/randomenv.cpp b/src/randomenv.cpp index 2d32e50cab7..3aff81d1437 100644 --- a/src/randomenv.cpp +++ b/src/randomenv.cpp @@ -57,8 +57,12 @@ #include #endif -#ifndef WIN32 -extern char** environ; // NOLINT(readability-redundant-declaration): Necessary on some platforms +#if defined(__APPLE__) || \ + defined(__FreeBSD__) || \ + defined(__NetBSD__) || \ + defined(__OpenBSD__) || \ + defined(__illumos__) +extern char** environ; // NOLINT(readability-redundant-declaration): Necessary on the above platforms #endif namespace {