Ask Your Question

include package ??

asked 2013-03-09 17:31:40 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hi. I have written a C++ program, which goes by the name:


located in:


Which works fine, but is unable to import one .h file:

    #include "ros/ros.h"
    #include "std_msgs/String.h"
    #include "std_msgs/Int8.h" 
//#include <sound_play/sound_play.h>
    #include <unistd.h>

Without the sound_play line, it works, and the program does what is expected. But i am needing to make use of sound_play. This is the catkin_make output when running it without commenting the line:

[100%] Building CXX object project1/CMakeFiles/project1.dir/src/listener.cpp.o
/home/user/catkin_ws/src/project1/src/listener.cpp:4:35: fatal error: sound_play/sound_play.h: No such file or directory
compilation terminated.

I do have installed audio_common, and already catkin_make'd it. It is located in:


And the terminal is "sourced" with:

source catkin_ws/devel/

I've tried (for testing purposes) to import other things, and it seems like it only allows you to import things that are in the opt/ros/share folder. By the way, what i want to do with sound_play is more or less like documented here: test.cpp for sound_play

How may I include sound_play package? Any help is welcomed, as I think i am not coping with the include and dependency system yet. Greetings ROS community.

EDIT: So after some answers, i decided to build with rosmake, and i followed more or less the listener talker tutorial. I created a package with the same dependencies, except for adding sound_play Whenever i build, it throws an error, because it cannot use ros.h properly:

Linking CXX executable ../bin/talker
  CMakeFiles/talker.dir/src/talker.cpp.o: In function `ros::Publisher ros::NodeHandle::advertise<std_msgs::String_<std::allocator<void> > >(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, bool)':
  /opt/ros/groovy/include/ros/node_handle.h:241: undefined reference to `ros::NodeHandle::advertise(ros::AdvertiseOptions&)'
  CMakeFiles/talker.dir/src/talker.cpp.o: In function `void ros::Publisher::publish<std_msgs::String_<std::allocator<void> > >(std_msgs::String_<std::allocator<void> > const&) const':
  /opt/ros/groovy/include/ros/publisher.h:106: undefined reference to `ros::Publisher::Impl::isValid() const'
  /opt/ros/groovy/include/ros/publisher.h:118: undefined reference to `ros::Publisher::publish(boost::function<ros::SerializedMessage ()> const&, ros::SerializedMessage&) const'
  CMakeFiles/talker.dir/src/talker.cpp.o: In function `main':
  /home/aimc/catkin_ws/src/include_test/src/talker.cpp:21: undefined reference to `ros::init(int&, char**, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)'
  /home/aimc/catkin_ws/src/include_test/src/talker.cpp:28: undefined reference to `ros::NodeHandle::NodeHandle(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std ...
edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2013-03-15 09:16:44 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I ended up solving this include problem with the following:

  • Everything messed up so i reinstalled ROS (I was incapable of even running begginer_tutorials)

  • I reinstalled basic componentes needed, sound_play for example: sound_play which is part of audio-common

  • I copied some ".h" files to the "include" folder of my project. In particular: "sound_play/sound_play.h" and "sound_play/soundRequest.h"

The third one ended up solving everything. This may be a workaround but works great. Hope this helps.

edit flag offensive delete link more

answered 2013-03-10 03:35:14 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Perhaps the package is not added as dependency. Check in the /home/user/catkin_ws/src/project1/manifest.xml file -- you should have there a line like

<depend package="sound_play"/>

edit flag offensive delete link more


No, i was wrong, i created a package with the sole purpose of testing this: $ catkin_create_pkg include_test rospy roscpp std_msgs sound_play

created OK, rospack says that dependencies are OK, but then catkin_make: CMake Error at /opt/ros/groovy/share/catkin/cmake/catkinConfig.cmake:71

aimc gravatar image aimc  ( 2013-03-13 15:46:04 -0500 )edit

(find_package): Could not find a configuration file for package sound_play.

Set sound_play_DIR to the directory containing a CMake configuration file for sound_play. The file will have one of the following names:

aimc gravatar image aimc  ( 2013-03-13 16:23:02 -0500 )edit

answered 2013-03-10 04:38:24 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Is sound_play maybe not catkin'ized, yet? You can only depend on catkin packages when using catkin.

edit flag offensive delete link more


Thx for the answer. I believe sound_play is correctly built; i might be wrong but executing the node works fine. However you got a point. I will test this.

aimc gravatar image aimc  ( 2013-03-13 15:50:49 -0500 )edit

Your Answer

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

Add Answer

Question Tools


Asked: 2013-03-09 17:31:40 -0500

Seen: 2,008 times

Last updated: Mar 15 '13