-
Notifications
You must be signed in to change notification settings - Fork 11
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
Redecleration of NOMINMAX macro on WIN32 #164
Comments
Are you sure this is the problem? I've searched the code in IMO, the preferred convention is to define
The drawback of defining it as a build-global setting with CMake is that it could easily leak out as a hidden requirement of the public API. (This is still a possibility with the convention suggested above, but it's smaller and more contained.) |
Sorry, you are right. It was defined in the .cpp file. But the problem of re-declaration is still present. If you think putting it in the CMake script is a bad idea, we should at least put a guard on it. |
The |
And? I'm experiencing this error, and it can be resolved by a simple guard. Why should it not be added? Note that this is not an issue with the current master + conan. But it can manifest itself with new 3rd party headers. It also appears when you add |
I am just trying to understand what is going on, mainly to rule out some deeper problem (e.g. with our build system). I really don't understand how adding a guard will fix any issue, and here's why: The definition of
then that should be exactly equivalent to what is there now, because If you are getting a compilation error, and that error is fixed by adding the extra guard, then there may be something fishy going on with our build system, and I'd like to see if we can fix that rather than add what should otherwise be a no-op to the source code. |
It sounded like this was a non-issue. Btw #if defined(_WIN32) and !defined(NOMINMAX)
#define NOMINMAX
#endif seems to be invalid code. #ifdef _WIN32
#ifndef NOMINMAX
# define NOMINMAX
#endif
#endif works. |
Sorry, what I meant was:
|
algorithm.hpp
algorithm.cpp
declaresNOMINMAX
without checking if it already is declared. This causes issues with 3rd party headers such as boost and thrift.Either a guard should be added or we just move it to the CMake script (cleanest solution IMO) as
algorithm.hpp
isn't necessary the only header that needs that macro.The text was updated successfully, but these errors were encountered: