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

Errors when building in Visual Studio 2017 #641

Open codekrafter opened 6 years ago

codekrafter commented 6 years ago

When I try to build the project it gives me many errors, most of them saying: Error C4596 'iterator': illegal qualified name in member declaration or Error C4596 'const_iterator': illegal qualified name in member declaration

Those both are in the header at lines 1508 and 1509. I have gotten this to build on linux with clang and on mac with clang. All help would be appreciated.

madduci commented 6 years ago

@codekrafter I've got the same error since the upgrade to MSVC 2017 15.7

I've resolved it by commenting out the following lines:

https://github.com/muflihun/easyloggingpp/blob/66a3a8741c42a512bd9237dff458bb6b055215e7/src/easylogging%2B%2B.h#L1363 https://github.com/muflihun/easyloggingpp/blob/66a3a8741c42a512bd9237dff458bb6b055215e7/src/easylogging%2B%2B.h#L1364 https://github.com/muflihun/easyloggingpp/blob/66a3a8741c42a512bd9237dff458bb6b055215e7/src/easylogging%2B%2B.h#L1439 https://github.com/muflihun/easyloggingpp/blob/66a3a8741c42a512bd9237dff458bb6b055215e7/src/easylogging%2B%2B.h#L1440

truejelly commented 2 years ago

Just had the same problem. But found a way to deal with it. C4596 is a warning of lowest severity. If it is a thing that fails your builds, check if you have "/WX" compiler flag set. This flag makes the compiler treat warning as errors. Remove it, and easyloggingpp will compile without errors. If you want to keep "/WX", you can add a flag "/wd4596" to disable just checking for C4596 warning.