Skip to content

loguru.cpp: warning C4005: 'WIN32_LEAN_AND_MEAN' and 'NOMINMAX': macro redefinition #244

Description

@BullyWiiPlaza

In my CMake project I'm including this library via a relative include directory. Even if I include the loguru.cpp file as the first line in main, I'm getting the following warnings:

C:\Cpp\MyProject\include\loguru.cpp(129): warning C4005: 'WIN32_LEAN_AND_MEAN': macro redefinition
C:\Cpp\MyProject\include\loguru.cpp(129): note: 'WIN32_LEAN_AND_MEAN' previously declared on the command line
C:\Cpp\MyProject\include\loguru.cpp(130): warning C4005: 'NOMINMAX': macro redefinition
C:\Cpp\MyProject\include\loguru.cpp(130): note: 'NOMINMAX' previously declared on the command line

These warnings can easily be solved by using the following conditional defines in loguru.cpp:

#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef NOMINMAX
#define NOMINMAX
#endif

Relevant code lines: https://github.com/emilk/loguru/blob/master/loguru.cpp#L129

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions