Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

format.cc (in header only mode) includes windows.h without defining WIN32_LEAN_AND_MEAN #297

Closed
gabime opened this issue Mar 21, 2016 · 3 comments

Comments

@gabime
Copy link
Contributor

gabime commented Mar 21, 2016

and this for example breaks boost and other libs

@vitaut
Copy link
Contributor

vitaut commented Mar 21, 2016

I don't think it's a good idea to define WIN32_LEAN_AND_MEAN there because it may break users who include windows.h without this macro and use these rare features. There are two alternative solutions:

  1. Define FMT_USE_WINDOWS_H to 0 if you don't need Windows error reporting functionality and Unicode converters provided by C++ Format.
  2. Define WIN32_LEAN_AND_MEAN yourself if you are OK with potential issues.

This can be done in the same place where you define FMT_HEADER_ONLY.

@gabime
Copy link
Contributor Author

gabime commented Mar 21, 2016

In this case I might define FMT_USE_WINDOWS_H to 0 in spdlog..

What is the Windows error reporting functionality?

@vitaut
Copy link
Contributor

vitaut commented Mar 21, 2016

It's WindowsError exception and report_windows_error function that automatically translate the error code returned by GetLastError() into a text message. The formatting functions don't use this, so if you don't use this either, spdlog won't be affected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants