abumq / easyloggingpp

C++ logging library. It is powerful, supports asynchronous low latency, extendable, light-weight, fast performing, thread and type safe and consists of many built-in features. It provides ability to write logs in your own customized format. It also provide support for logging your classes, third-party libraries, STL and third-party containers etc.
MIT License
3.76k stars 920 forks source link

Include of "easylogging++.h" stl function from header <limits> break! #547

Open Johanneslueke opened 7 years ago

Johanneslueke commented 7 years ago

Hello, I've got the following issue under VS Community 17: If i include easylogging++.h suddenly the stl function

get not recognized anymore by the compiler. I'm not even using any parts of your library yet but the compiler now believes to see the macros min and max.

I haven't got really an idea what this is causing because after studying the header-file it does not seem you using anything from <limits> header or overriding via macro anything .

so ....yeah No Idea what the reason for this is

The code you find here Measurement.h at line 121 to 123

your header I do include in my main.cpp file as first include

victorlee816 commented 6 years ago

I ran in to this problem today. The solution is to add a #define NOMINMAX and #include before you call #include . The easyloggingpp calls #include inside the header.

In my case, I added the definition to my CMakefile:

add_definitions( -DNOMINMAX )