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

undefined reference to `ros::init error with catkin_make_isolated

asked 2023-02-26 13:07:33 -0500

anirban gravatar image

Hi,

I am trying to build the ros packages here. I am using catkin_make_isolated to build the workspace because of the existence of a non catkin package in the workspace. While all the other packages are built successfully, building of the package open3d_conversions_examples throwing the following error. Only a portion of the error is given below.

/usr/bin/ld: CMakeFiles/ex_statistical_outlier_removal.dir/src/ex_statistical_outlier_removal.cpp.o: in function `main':
ex_statistical_outlier_removal.cpp:(.text+0x95): undefined reference to `ros::init(int&, char**, std::string const&, unsigned int)'
/usr/bin/ld: ex_statistical_outlier_removal.cpp:(.text+0x127): 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&)'
/usr/bin/ld: ex_statistical_outlier_removal.cpp:(.text+0x1d6): 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&)'
/usr/bin/ld: CMakeFiles/ex_statistical_outlier_removal.dir/src/ex_statistical_outlier_removal.cpp.o: in function  SubscribeFilterPublish::SubscribeFilterPublish(ros::NodeHandle&, ros::NodeHandle&)':

To me it looks like it is related to roscpp but could not figure out how to eliminate the build error. I tried the solutions proposed in here and here. But none of them worked for me.

Any suggestions to solve this problem will be very helpful.

Regards,

Anirban

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-02-27 16:57:27 -0500

Mike Scheutzow gravatar image

I'm not an expert on isolated builds, but I think typical practice is to use separate catkin directory trees for the ros-packages and the isolated-packages. The workflow is: build the isolated-package, install the isolated-package, then build the ros-package(s).

The fact that you have put both types of packages into a shared directory tree is why you are getting this error.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2023-02-26 13:07:33 -0500

Seen: 83 times

Last updated: Feb 27 '23