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

Compile error ros kinetic ubuntu 16.04

asked 2018-05-28 06:38:14 -0500

Maximus gravatar image

updated 2018-05-28 07:06:51 -0500

gvdhoorn gravatar image

Hi there, i am using ros kinetic on ubuntu 16.04. I simply tried to compile talker listener example of the ros tutorial and always receive the follow compiler/linker error:

CMakeFiles/talker.dir/src/talker.cpp.o: In function `main':
talker.cpp:(.text+0x70): undefined reference to `ros::init(int&, char**, std::string const&, unsigned int)'
talker.cpp:(.text+0xcc): undefined reference to `ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)'
talker.cpp:(.text+0x29a): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
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':
talker.cpp:(.text._ZNK3ros9Publisher7publishIN8std_msgs7String_ISaIvEEEEEvRKT_[_ZNK3ros9Publisher7publishIN8std_msgs7String_ISaIvEEEEEvRKT_]+0xa0): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
talker.cpp:(.text._ZNK3ros9Publisher7publishIN8std_msgs7String_ISaIvEEEEEvRKT_[_ZNK3ros9Publisher7publishIN8std_msgs7String_ISaIvEEEEEvRKT_]+0x1a3): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
talker.cpp:(.text._ZNK3ros9Publisher7publishIN8std_msgs7String_ISaIvEEEEEvRKT_[_ZNK3ros9Publisher7publishIN8std_msgs7String_ISaIvEEEEEvRKT_]+0x29e): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
talker.cpp:(.text._ZNK3ros9Publisher7publishIN8std_msgs7String_ISaIvEEEEEvRKT_[_ZNK3ros9Publisher7publishIN8std_msgs7String_ISaIvEEEEEvRKT_]+0x3c1): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
CMakeFiles/talker.dir/src/talker.cpp.o:talker.cpp:(.text._ZNK3ros9Publisher7publishIN8std_msgs7String_ISaIvEEEEEvRKT_[_ZNK3ros9Publisher7publishIN8std_msgs7String_ISaIvEEEEEvRKT_]+0x4c4): more undefined references to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)' follow
collect2: error: ld returned 1 exit status
trajectoryplanning/CMakeFiles/talker.dir/build.make:113: recipe for target '/home/graf/catkin_ws/devel/lib/trajectoryplanning/talker' failed
make[2]: *** [/home/graf/catkin_ws/devel/lib/trajectoryplanning/talker] Error 1
CMakeFiles/Makefile2:526: recipe for target 'trajectoryplanning/CMakeFiles/talker.dir/all' failed
make[1]: *** [trajectoryplanning/CMakeFiles/talker.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
CMakeFiles/listener.dir/src/listener.cpp.o: In function `chatterCallback(boost::shared_ptr<std_msgs::String_<std::allocator<void> > const> const&)':
listener.cpp:(.text+0x78): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
CMakeFiles/listener.dir/src/listener.cpp.o: In function `main':
listener.cpp:(.text+0x1dc): undefined reference to `ros::init(int&, char**, std::string const&, unsigned int)'
listener.cpp:(.text+0x238): undefined reference to `ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)'
CMakeFiles/listener.dir/src/listener.cpp.o: In function `ros::SubscriptionCallbackHelperT<boost::shared_ptr<std_msgs::String_<std::allocator<void> > const> const&, void>::deserialize(ros::SubscriptionCallbackHelperDeserializeParams const&)':
listener.cpp:(.text._ZN3ros27SubscriptionCallbackHelperTIRKN5boost10shared_ptrIKN8std_msgs7String_ISaIvEEEEEvE11deserializeERKNS_43SubscriptionCallbackHelperDeserializeParamsE[_ZN3ros27SubscriptionCallbackHelperTIRKN5boost10shared_ptrIKN8std_msgs7String_ISaIvEEEEEvE11deserializeERKNS_43SubscriptionCallbackHelperDeserializeParamsE]+0xba): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
collect2: error: ld returned 1 exit status
trajectoryplanning/CMakeFiles/listener.dir/build.make:113: recipe for target '/home/graf/catkin_ws/devel/lib/trajectoryplanning/listener' failed
make[2]: *** [/home/graf/catkin_ws/devel/lib/trajectoryplanning/listener] Error 1
CMakeFiles/Makefile2 ...
(more)
edit retag flag offensive close merge delete

Comments

1

This is a linker problem you're having here. Can you add your CMakeLists.txt file as well. Then we should be able to work out what the problem is.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-05-28 12:38:20 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-05-29 04:00:46 -0500

Maximus gravatar image

Thanks for your answer! But i solved the problem. I compiled my code with g++-4.9, when i changed to g++-5.4 it worked.

best regards,

Max

edit flag offensive delete link more

Question Tools

Stats

Asked: 2018-05-28 06:38:14 -0500

Seen: 200 times

Last updated: May 29 '18