-
Notifications
You must be signed in to change notification settings - Fork 280
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
tf2_msgs: NO_ERROR creates a name clash on Windows with MSVC #172
Comments
We're compiling for Windows in the ros2 prototypes and I don't believe that we've run into this issue. Is it enough to do this just in the header? Or are we just luck that it's defined the same in the implementation? |
Looking into this, it's the generated code from the msg. And our usage is properly scoped. There's already a large code base using this so we can't easily switch. If this is something that continues to be a problem we will have to patch the code generator to do the undef. But for now since this is known to work on Windows in most cases it might make sense to undef this anytime you use a header that brings in WinError.h or make sure that the message file is included before WinError.h. I'm going to close this as I think it's out of scope for fixing in this repository. |
This issue happens on my PC when a Windows SDK is installed. The build issue disappeared when the SDK has been uninstalled. It's OK to leave this unfixed but then ROS2 can't claim formal Windows compatibility since Windows SDK is essential for Windows GUI development. |
The TF2Error.msg file defines on its first line
uint8 NO_ERROR = 0
. The generated C++ code for this message in include/tf2_msgs/TF2Error.h includes the following lineThis line causes a name clash on Windows with MSVC and MinGW, since
NO_ERROR
is already defined to be a constant 0. A simple fix would be to conditionally undefineNO_ERROR
on Windows in the generated C++ code, e.g. as done here and here.The relevant part of the compilation error on Windows using MSVC and NMake is below
The text was updated successfully, but these errors were encountered: