undefined reference to `ros::init error with catkin_make_isolated
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
Asked by anirban on 2023-02-26 14:07:33 UTC
Answers
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.
Asked by Mike Scheutzow on 2023-02-27 17:57:27 UTC
Comments