Correct way of modifying ROS classes? (do I have to edit installed headers directly?)
Goal: Add a new member function in callback_queue.cpp from roscpp (ros_comm stack)
Problem: make error "no member function declared in class ‘ros::CallbackQueue’"
Details: To get the roscpp source, I followed the instructions to build from source (http://www.ros.org/wiki/fuerte/Installation/Ubuntu/Source).
I added my new member function in /home/xyz/ros-underlay/ros_comm/clients/cpp/roscpp/src/libros/callback_queue.cpp and declared it in /home/xyz/ros-underlay/ros_comm/clients/cpp/roscpp/include/ros/callback_queue.h
However, when performing (in /home/xyz/ros-underlay/build)
cmake .. -DCMAKE_INSTALL_PREFIX=/opt/ros/fuerte
make -j8
I get the error
/home/xyz/ros-underlay/ros_comm/clients/cpp/roscpp/src/libros/callback_queue.cpp:75:29:
error: no ‘void ros::CallbackQueue::my_new_func()’ member function declared
in class ‘ros::CallbackQueue’
I can get rid of this error by editing the already installed header file (/opt/ros/fuerte/include/ros/callback_queue.h) and declaring the new member function there. However I guess it's not the recommended approach to work directly on the installed header files, instead of those in /home/xyz/ros_underlay (?).
-> So my question is what is the correct approach when I want to perform some edits in ROS files like callback_queue.cpp? Should I somehow tell make (or CMakelists.txt) to use the headers in /home/xyz/ros-underlay/ros_comm/clients/cpp/roscpp/include/ros instead?
I'm somewhat surprised make isn't already using the headers that go along with the sources you configured as opposed to the ones in /opt/ros ... Is catkin/cmake setting the include directories to /opt/ros (or otherwise your ROS_PACKAGE_PATH) and putting those before the headers in your source build?
Maybe you could try make -j1 VERBOSE=1 to get more verbose output and include the make line for callback_queue.cpp here so we can take a look at the include paths that the compiler is using.