Ask Your Question

Correct way of modifying ROS classes? (do I have to edit installed headers directly?)

asked 2012-07-07 10:49:50 -0500

rob20 gravatar image

updated 2012-07-07 23:30:12 -0500

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 (

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

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?

edit retag flag offensive close merge delete


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?

Eric Perko gravatar image Eric Perko  ( 2012-07-08 08:43:04 -0500 )edit

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.

Eric Perko gravatar image Eric Perko  ( 2012-07-08 08:43:56 -0500 )edit

2 Answers

Sort by » oldest newest most voted

answered 2012-07-07 23:23:09 -0500

rob20 gravatar image

updated 2012-07-08 06:31:05 -0500

Thanks joq, but that did not solve the issue: I still have to edit the installed header file (as opposed to the header file in the source tree), and I don't think that's a good way (?). The only thing that using -DCMAKE_INSTALL_PREFIX changed was that the installation is now in my home directory instead of /opt/ros/fuerte.


According to your suggestion, I created a new install subdir /home/xyz/ros-underlay/install, and then, from /home/xyz/ros-underlay, called

cmake .. -DCMAKE_INSTALL_PREFIX=../install
make -j8
sudo make install

For the first sudo make install I could run make to have my modified callback_queue compiled. But for subsequent changes, I get the same make error as in my original question, and I can only get rid of it by editing the installed header file in /home/xyz/ros-underlay/install, instead of the "source" version in /home/xyz/ros-underlay/ros_comm/clients/cpp/roscpp/include/ros.

P.S. I wanted to post this as a comment to your answer, but there was no comment field (I only see comment fields under my own posts so far).

edit flag offensive delete link more


This is too long to be a comment. You should update your original question to include this additional information. That's also better than using an answer for something too long for a comment so that it doesn't get re-ordered in the future as answers get sorted by votes/date/etc

Eric Perko gravatar image Eric Perko  ( 2012-07-08 08:39:23 -0500 )edit

answered 2012-07-07 14:21:12 -0500

joq gravatar image

Try setting a different CMAKE_INSTALL_PREFIX.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2012-07-07 10:49:50 -0500

Seen: 360 times

Last updated: Jul 08 '12