Hi. I have written a C++ program, which goes by the name:
listener.cpp
located in:
/home/user/catkin_ws/src/project1/src/listener.cpp
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:
/opt/ros/groovy/stacks/
And the terminal is "sourced" with:
source catkin_ws/devel/setup.sh
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::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&)'
/home/aimc/catkin_ws/src/include_test/src/talker.cpp:77: undefined reference to `ros::spinOnce()'
/home/aimc/catkin_ws/src/include_test/src/talker.cpp:56: undefined reference to `ros::ok()'
/home/aimc/catkin_ws/src/include_test/src/talker.cpp:84: undefined reference to `ros::Publisher::~Publisher()'
/home/aimc/catkin_ws/src/include_test/src/talker.cpp:84: undefined reference to `ros::NodeHandle::~NodeHandle()'
/home/aimc/catkin_ws/src/include_test/src/talker.cpp:84: undefined reference to `ros::Publisher::~Publisher()'
/home/aimc/catkin_ws/src/include_test/src/talker.cpp:84: undefined reference to `ros::NodeHandle::~NodeHandle()'
collect2: ld returned 1 exit status
make[3]: *** [../bin/talker] Error 1
make[3]: Leaving directory `/home/aimc/catkin_ws/src/include_test/build'
make[2]: *** [CMakeFiles/talker.dir/all] Error 2
make[2]: Leaving directory `/home/aimc/catkin_ws/src/include_test/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/aimc/catkin_ws/src/include_test/build'
-------------------------------------------------------------------------------}
[ rosmake ] Output from build of package include_test written to:
[ rosmake ] /home/aimc/.ros/rosmake/rosmake_output-20130314-002400/include_test/build_output.log
[rosmake-2] Finished <<< include_test [FAIL] [ 4.25 seconds ]
[ rosmake ] Halting due to failure in package include_test.
[ rosmake ] Waiting for other threads to complete.
[ rosmake ] Results:
[ rosmake ] Built 25 packages with 1 failures.
Many thanks for any more advices to my issue. Greetings.,
Originally posted by aimc on ROS Answers with karma: 216 on 2013-03-09
Post score: 0