-
Notifications
You must be signed in to change notification settings - Fork 436
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
Add -DNOMINMAX compiler definition for Windows #1054
Conversation
This fixes an issue where max() and min() are treated as macros defined in windows.h Signed-off-by: Jacob Perron <jacob@openrobotics.org>
I think this is also ok to do, but there are cases where people do want the min/max macros, e.g.: Also, unless we export that definition it will not work when someone trys to use our headers (without adding the compiler definition themselves). |
I did not want to export the definition. I made this change assuming that we don't want to use the min/max macros in the rclcpp packages. Users can still use them if they want, and will have to workaround our definitions if they happen to include the macros before our headers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this approach
Since this is not necessary anymore and wouldn't prevent downstream packages to fail I don't think this should be merged. |
I see it as defensive. We're currently relying on external packages (e.g. rcutils) to not include Windows.h or have them define |
If any dependency introduces such an include this patch I would expect the patch to only work around the problem when building this package but downstream code would still fail to build, right? |
That's right, I was only trying to ensure that this package builds. In retrospect, maybe not a great patch considering it might be better for us to avoid shipping a "broken" rclcpp accidentally. |
This fixes an issue where max() and min() are treated as macros defined in windows.h
Alternative to #1053
Windows: