Ros couldn't find roscpp libraries

asked 2019-02-12 07:02:16 -0500

ofaruk_demirci gravatar image

updated 2019-02-12 09:17:51 -0500

Hello all, I try to compile one my packages. However, it couldn't find roscpp libraries at all. Therefore, I am getting the error shown blow.

I searched on the internet for the similar problems but the provided solutions couldn't help me to solve my problem. My cmakelist is also given below.

Errors     << line_follower_odtu:make /home/ofd/catkin_ws/logs/line_follower_odtu/build.make.037.log
CMakeFiles/line_follower_code.dir/src/line_follower_code.cpp.o: In function `main':
line_follower_code.cpp:(.text+0xd54): undefined reference to `ros::init(int&, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)'
line_follower_code.cpp:(.text+0xdb0): undefined reference to `ros::NodeHandle::NodeHandle(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&)'
line_follower_code.cpp:(.text+0xe7f): undefined reference to `ros::Subscriber::~Subscriber()'
line_follower_code.cpp:(.text+0xf51): undefined reference to `ros::Subscriber::~Subscriber()'
line_follower_code.cpp:(.text+0x1006): undefined reference to `ros::ServiceClient::~ServiceClient()'
line_follower_code.cpp:(.text+0x10a8): undefined reference to `ros::Publisher::~Publisher()'
line_follower_code.cpp:(.text+0x113b): undefined reference to `ros::Publisher::~Publisher()'
line_follower_code.cpp:(.text+0x11fe): undefined reference to `ros::Subscriber::~Subscriber()'
line_follower_code.cpp:(.text+0x140e): undefined reference to `ros::ok()'
line_follower_code.cpp:(.text+0x1432): undefined reference to `ros::spinOnce()'
line_follower_code.cpp:(.text+0x16af): undefined reference to `ros::ServiceClient::~ServiceClient()'
line_follower_code.cpp:(.text+0x16be): undefined reference to `ros::ServiceClient::~ServiceClient()'
line_follower_code.cpp:(.text+0x16cd): undefined reference to `ros::ServiceClient::~ServiceClient()'
line_follower_code.cpp:(.text+0x16dc): undefined reference to `ros::NodeHandle::~NodeHandle()'
line_follower_code.cpp:(.text+0x1e2f): undefined reference to `ros::ok()'
line_follower_code.cpp:(.text+0x1f8e): undefined reference to `ros::spinOnce()'
line_follower_code.cpp:(.text+0x2392): undefined reference to `ros::ServiceClient::~ServiceClient()'
line_follower_code.cpp:(.text+0x23a1): undefined reference to `ros::ServiceClient::~ServiceClient()'
line_follower_code.cpp:(.text+0x23b0): undefined reference to `ros::ServiceClient::~ServiceClient()'
line_follower_code.cpp:(.text+0x23c4): undefined reference to `ros::NodeHandle::~NodeHandle()'
CMakeFiles/line_follower_code.dir/src/line_follower_code.cpp.o: In function `__static_initialization_and_destruction_0(int, int)':
line_follower_code.cpp:(.text+0x3294): undefined reference to `ros::Subscriber::~Subscriber()'
line_follower_code.cpp:(.text+0x32b2): undefined reference to `ros::Subscriber::~Subscriber()'
line_follower_code.cpp:(.text+0x32d0): undefined reference to `ros::Subscriber::~Subscriber()'
line_follower_code.cpp:(.text+0x32ee): undefined reference to `ros::ServiceClient::~ServiceClient()'
line_follower_code.cpp:(.text+0x330c): undefined reference to `ros::Publisher::~Publisher()'
line_follower_code.cpp:(.text+0x3334): undefined reference to `ros::Publisher::~Publisher()'
CMakeFiles/line_follower_code.dir/src/line_follower_code.cpp.o: In function `void ros::Publisher::publish<geometry_msgs::TwistStamped_<std::allocator<void> > >(geometry_msgs::TwistStamped_<std::allocator<void> > const&) const':
line_follower_code.cpp:(.text._ZNK3ros9Publisher7publishIN13geometry_msgs13TwistStamped_ISaIvEEEEEvRKT_[_ZNK3ros9Publisher7publishIN13geometry_msgs13TwistStamped_ISaIvEEEEEvRKT_]+0x371): undefined reference to `ros::Publisher::Impl::isValid() const'
line_follower_code.cpp:(.text._ZNK3ros9Publisher7publishIN13geometry_msgs13TwistStamped_ISaIvEEEEEvRKT_[_ZNK3ros9Publisher7publishIN13geometry_msgs13TwistStamped_ISaIvEEEEEvRKT_]+0xbfc): undefined reference to `ros::Publisher::publish(boost::function<ros::SerializedMessage ()> const&, ros::SerializedMessage&) const'
CMakeFiles/line_follower_code.dir/src/line_follower_code.cpp.o: In function `void ros::Publisher::publish ...
(more)
edit retag flag offensive close merge delete

Comments

At the moment your CMakeLists isn't valid: you have an extra line (${catkin_EXPORTED_TARGETS})) or are missing a line on top of it (maybe add_dependencies(line_follower_code but that would be under the add_executable...). There is also a double call to catkin_package() which seems wrong.

aPonza gravatar image aPonza  ( 2019-02-12 10:59:22 -0500 )edit

Are you familiar with the basic tutorials and possibly the CMakeLists stuff?

aPonza gravatar image aPonza  ( 2019-02-12 11:01:40 -0500 )edit

Yes, I work on it for a while. Maybe more than 5 months. There is no ${catkin_EXPORTED_TARGETS}) in my actual code. I think the editor organized my codes to look better and deleted the commented lines. The related line was commented as well.

ofaruk_demirci gravatar image ofaruk_demirci  ( 2019-02-12 14:50:15 -0500 )edit