Haven’t been able to find a solution anywhere that solves my exact problem. I have a simple pair of C++ files called geometry_utils.h and geometry_utils.cpp, and I use CMake to compile them into a library called geometry_utils.
Then I have a bunch of executable files that include geometry_utils.h and link against that library. Simple enough, and it all works fine, UNLESS I try to call one of the following two functions:
geometry_msgs::Transform vectorToTransform(const Eigen::VectorXd & poseVector);
Eigen::VectorXd transformToVector(const geometry_msgs::Transform & transform);
Two simple utility functions for converting a ROS transform object to or from a six-element Eigen::VectorXd. If, in my executable file, I call either of those two functions, it still compiles without any errors or warnings, but when I try to run the executable it fails with an error that looks like this:
undefined symbol: _ZN14geometry_utils17vectorToTransformERKN5Eigen6MatrixIdLin1ELi1ELi0ELin1ELi1EEE
or
undefined symbol: _ZN14geometry_utils17transformToVectorERKN13geometry_msgs10Transform_ISaIvEEE
I feel like if it was something “obvious”, like forgetting to include the “.h” file or forgetting to link against the geometry_utils library, then either the compile step would fail, or I’d get a similar error when trying to call any function defined in geometry_utils.h, instead of just for those two.
Also, I verified that if I comment out the implementations in the cpp file, it fails to compile, so I think that means I didn’t do something like misspell the function names in the cpp file or anything like that.
So the only thing I can think of is there’s something it doesn’t like about the use of the Eigen::VectorXd type, but I’m not sure what the problem is.
1