ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Adding Header files to package

asked 2011-05-31 11:35:28 -0600

This may be so elementary, but by using functions from any header file in the "include/whatever_pkg_name" folder of the package, the compiler complains about "Undefined reference to...". What step am I missing? The include files are properly called from the source code.

edit retag flag offensive close merge delete

Comments

Looks like a linking problem. Are you calling functions from an outside package?
Ivan Dryanovski gravatar image Ivan Dryanovski  ( 2011-05-31 11:45:30 -0600 )edit
No, it's nothing external. It's a very simple call to a function declared on a header file inside the "include" folder. I will send you the code for you to see what I'm talking about.
ubuntuslave gravatar image ubuntuslave  ( 2011-05-31 14:22:14 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2011-05-31 17:02:24 -0600

updated 2011-05-31 17:04:53 -0600

Actually, my problem was that I wasn't including the related .cpp files in the CMakeLists.txt, for example, I only had

rosbuild_add_executable(sphereo_node src/sphereo.cpp)

which was missing the remaining source files that implement the functions in the header file my_header.h, such as:

rosbuild_add_executable(sphereo_node src/sphereo.cpp src/my_header.cpp)

Thanks to Bill and Ivan!

edit flag offensive delete link more

Comments

Thanks! Searched for quite a while. Thanks for pointing out such a mistake for me. Now it seems so obvious... :)

niosus gravatar image niosus  ( 2012-12-11 01:50:50 -0600 )edit

Question Tools

Stats

Asked: 2011-05-31 11:35:28 -0600

Seen: 1,831 times

Last updated: May 31 '11