Native C ++ library gives an error with C ++ 11 parameter

I have the following C ++ code where I used the Eigen C ++ Library.

#include "Dense"
#include <iostream>

int main()
{
    Eigen::MatrixXf x(10,10);
    x.setRandom();
    std::cout<<"x is ..\n"<<x<<std::endl;


    return 0;
}

When I try g ++ with "-std = gnu ++ 11", it gives the following error.

In file included from /usr/include/c++/4.8/tuple:39:0,
                 from /usr/include/c++/4.8/functional:55,
                 from ../SP_ToolBox/ExternalLibraries/Eigen/Eigen/Core:153,
                 from ../SP_ToolBox/ExternalLibraries/Eigen/Eigen/Dense:1,
                 from test.cpp:1:
../SP_ToolBox/ExternalLibraries/Eigen/Eigen/array:8:4: error: #error The Eigen/Array header does no longer exist in Eigen3. All that functionality has moved to Eigen/Core.
   #error The Eigen/Array header does no longer exist in Eigen3. All that functionality has moved to Eigen/Core.
    ^
In file included from /usr/include/c++/4.8/functional:55:0,
                 from ../SP_ToolBox/ExternalLibraries/Eigen/Eigen/Core:153,
                 from ../SP_ToolBox/ExternalLibraries/Eigen/Eigen/Dense:1,
                 from test.cpp:1:
/usr/include/c++/4.8/tuple:885:33: error: ‘array’ was not declared in this scope
     struct __is_tuple_like_impl<array<_Tp, _Nm>> : true_type
                                 ^
/usr/include/c++/4.8/tuple:885:44: error: wrong number of template arguments (2, should be 1)
     struct __is_tuple_like_impl<array<_Tp, _Nm>> : true_type
                                            ^
/usr/include/c++/4.8/tuple:873:12: error: provided for ‘template<class> struct std::__is_tuple_like_impl
     struct __is_tuple_like_impl : false_type
            ^
/usr/include/c++/4.8/tuple:885:47: error: expected unqualified-id before ‘>’ token
     struct __is_tuple_like_impl<array<_Tp, _Nm>> : true_type

It compiles fine if I remove the "-std = gnu ++ 11" option. My gcc version is 4.8.4 and the Eigen Library version is 3.2.10.

+4
source share
1 answer

It seems that you included the Eigen include directory directly in the search path of the header file. This means that when you include the standard header file, the <array>compiler will actually include the Eigen header file array.

-I, , , . ../SP_ToolBox/ExternalLibraries/Eigen (.. /Eigen).

<Eigen/Dense>.

+5

Source: https://habr.com/ru/post/1659906/


All Articles