[eigen] Link error using -On flag (g++ 4.7.2)

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi,

I have a problem when compiling some simple code (under g++ 4.7) that implies the cross product and gcc optimization flags.

Indeed, when I compile
    #include <Eigen/Core>

    #include <iostream>

    int main() {
        Eigen::Vector3f a(0, 1, 0);
        Eigen::Vector3f b(1, 0, 0);

        std::cout << a.cross(b) << std::endl;

        return 0;
    }

Gcc gives me the following link error :

main.cpp:(.text.startup+0x40): undefined reference to `Eigen::MatrixBase<Eigen::Matrix<float, 3, 1, 0, 3, 1> >::cross_product_return_type<Eigen::Matrix<float, 3, 1, 0, 3, 1> >::type Eigen::MatrixBase<Eigen::Matrix<float, 3, 1, 0, 3, 1> >::cross<Eigen::Matrix<float, 3, 1, 0, 3, 1> >(Eigen::MatrixBase<Eigen::Matrix<float, 3, 1, 0, 3, 1> > const&) const'

collect2: error: ld returned 1 exit status


This code compiles and works well without -On flags.
Did I miss anything ?

Thanks,
Cheers,

Charly


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/