Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems with Eigen library and c++ linker

I try to link my c++ application against the "Eigen 2.0.15" library. Some details:

  • My compiler is: gcc version 4.0.1 (Apple Inc. build 5493)
  • My OS is: mac os 10.5
  • I compile the code with g++ -I/opt/local/include -I/opt/local/include/eigen2 -O2 -g ...

    Building target: LBRALL Invoking: MacOS X C++ Linker g++ -L/opt/local/lib -o "LBRALL" [... *.o -files ] -lcv -lEigen2 -lcxcore -lhighgui

The error is:

`Undefined symbols:
"Eigen::MatrixBase<Eigen::Block<Eigen::Matrix<float, 4, 4, 2, 4, 4>, 3, 3, 1, 32>    >::inverse() const", referenced from:
  Eigen::Transform<float, 3>::inverse(Eigen::TransformTraits) constin LBRSendStateCart.o
  Eigen::Transform<float, 3>::inverse(Eigen::TransformTraits) constin LBRCam.o
"Eigen::MatrixBase<Eigen::Matrix<float, 4, 4, 2, 4, 4> >::inverse() const", referenced from:
  Eigen::Transform<float, 3>::inverse(Eigen::TransformTraits) constin LBRSendStateCart.o
  Eigen::Transform<float, 3>::inverse(Eigen::TransformTraits) constin LBRCam.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [LBRALL] Error 1`

Does anybody have an idea why the linker fails?

like image 878
nutario Avatar asked Nov 05 '22 05:11

nutario


1 Answers

Looking at the error messages, my guess you didn't instantiate Matrix, Transform and possibly other templates. That happened probably because the header files didn't contain implementation of those templates, or maybe there is a conditional compilation that is supposed to pull up implementation for them.

like image 76
Gene Bushuyev Avatar answered Nov 09 '22 15:11

Gene Bushuyev