emilk / emilk/loguru

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

Open
#244 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.9k
Forks
280
Avg merge
7m
Merged PRs (30d)
4

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.