Skip to content

Commit

Permalink
#undef ERROR on windows to avoid conflict with constant by the same name
Browse files Browse the repository at this point in the history
  • Loading branch information
gerkey committed Apr 15, 2016
1 parent d89387d commit d4264b7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rosidl_generator_cpp/resource/msg__struct.hpp.template
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ header_guard_variable = '__'.join([x.upper() for x in header_guard_parts]) + '_'
#ifndef @(header_guard_variable)
#define @(header_guard_variable)

// Protect against ERROR being predefined on Windows, in case somebody defines a
// constant by that name.
#if defined(_WIN32 ) && defined(ERROR)
#undef ERROR
#endif

@{
from rosidl_generator_cpp import escape_string
from rosidl_generator_cpp import msg_type_to_cpp
Expand Down

2 comments on commit d4264b7

@dirk-thomas
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always undefining ERROR even if the message doesn't even define such a constant is imo an undesired side effect. If we have to do this for now I think it should only happen if absolutely necessary.

@gerkey
Copy link
Member Author

@gerkey gerkey commented on d4264b7 Apr 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ticketed: #118

Please sign in to comment.