personalrobotics / or_rviz

OpenRAVE viewer plugin that publishes the environment to RViz as InteractiveMarkers.
BSD 2-Clause "Simplified" License
5 stars 5 forks source link

Add incude guards as workaround for Qt Moc bug #29

Closed cdellin closed 9 years ago

cdellin commented 9 years ago

On my system, or_rviz fails to compile with:

usr/include/boost/type_traits/detail/has_binary_operator.hp:50: Parse error at "BOOST_JOIN"

This is a known bug with Qt Moc (see [0]) before Qt 5.0 that apparently affects class definitions that include some version of boost's BOOST_JOIN macro. This apparently includes my system. I'm using the latest OpenRAVE, Qt 4.8, and Boost 1.49.0 on Debian Wheezy.

I was able to fix the issue on my system by applying the suggested workaround from the linked bug report. This PR adds the workaround.

[0] https://bugreports.qt.io/browse/QTBUG-22829

psigen commented 9 years ago

Does this header guard affect future compatibility with QT 5.0+?

cdellin commented 9 years ago

No, the moc meta-compiler does not need access to any of the OpenRAVE stuff, now or going forward. There are lots of reports of this type of workaround being necessary even with Qt 5 (e.g. [0]), albeit for different offenders in Boost. [0] https://forum.qt.io/topic/22458/semi-solved-qt5-moc-error-in-combination-with-boost

psigen commented 9 years ago

Ok, that seems reasonable then.

Can we put normal indentation before the nested #include? Requiring lines to start with # is a holdover from pre-ANSI C.

mkoval commented 9 years ago

@psigen is correct. Indenting pre-processing directives is allowed in both C90 and C99.

mkoval commented 9 years ago

@jeking04 confirmed that this doesn't break anything on 14.04, so I am happy to merge this as soon as @cdellin fixes the spacing. :smile:

cdellin commented 9 years ago

I used four spaces for indentation. I thought that might make y'all happy.

mkoval commented 9 years ago

:+1: Thanks @cdellin and @jeking04!

@cdellin: I would have preferred 3.5 space indention. But we can't always get what we want. :frowning: