ros / geometry

Packages for common geometric calculations including the ROS transform library, "tf". Also includes ROS bindings for "bullet" physics engine and "kdl" kinematics/dynamics package.
173 stars 274 forks source link

fix build issues on Windows #182

Closed kejxu closed 4 years ago

kejxu commented 5 years ago
tfoote commented 5 years ago

In our past discussions of this we've talked about undefining and then later redefining it after we've used it. Do you think that's necessary/valuable?

kejxu commented 5 years ago

In our past discussions of this we've talked about undefining and then later redefining it after we've used it. Do you think that's necessary/valuable?

that would be optimal, but might turn out to be too much work in practice. the reason is that NO_ERROR (or something similar) in the Windows header is a macro so it has to be un-defined each time NO_ERROR is used. for example (tf2 has a similar issue), in https://github.com/ros/geometry2/blob/melodic-devel/tf2_ros/src/buffer_client.cpp#L109

if(result.error.error != result.error.NO_ERROR){
    // ...
}

has to become

#if defined(NO_ERROR)
#undef NO_ERROR
if(result.error.error != result.error.NO_ERROR){
// re-define NO_ERROR from winerror.h
#define NO_ERROR 0L
#endif
    // ...
}

and this has to happen not only when the header is included, but also everywhere it's used. seems to me would make the code vulnerable, hard to read, and hard to maintain. this is definitely good approach and feasible, but other developers consuming this package might not know that this is necessary.

other solutions:

seanyen commented 5 years ago

@tfoote any feedbacks on this? Thanks!

seanyen commented 5 years ago

@tfoote Sorry to ping again. Any chance to take a look so we can move this PR forward?

seanyen commented 4 years ago

@sloretz @tfoote Happy new year. This is ready for review and merge. Hope we can move this forward for noetic and melodic.