特征C++库给出了C++11选项的错误
Eigen C++ Library gives error with C++ 11 option
我有下面的C++代码,其中我使用了Eigen C++库。
#include "Dense"
#include <iostream>
int main()
{
Eigen::MatrixXf x(10,10);
x.setRandom();
std::cout<<"x is ..n"<<x<<std::endl;
return 0;
}
当我用"-std=gnu++11"尝试g++时,会出现以下错误。
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
如果我去掉"-std=gnu++11"选项,它编译得很好。我的gcc版本是4.8.4,特征库版本是3.2.10。
您似乎已经将Eigen include目录直接放在了头文件搜索路径上。这意味着当包含标准<array>
头文件时,编译器实际上会包含Eigen array
头文件。
将您的-I
标志更改为不包括完整路径,仅包括例如../SP_ToolBox/ExternalLibraries/Eigen
(即丢弃最后一个/Eigen
(。
然后改为包含<Eigen/Dense>
。
相关文章:
- C++11 std::regex后备选项
- 无法在Eclipse Neon.3中同时使用-std = C 11和-l/-l选项
- 如何在 DirectX 11 应用程序中提供选择图形适配器的选项?
- 使用 C++11 选项编译 C++98 代码时由于 Boost 标头而导致的不明确重载
- g 编译选项,带有-STD = C 14编译错误显示Werror = C 11 -Compat
- 从源代码构建Qt 5.8 - 配置:未知命令行选项'-c++11'
- C++11 cmake O3 选项<没有用于初始化 'std::thread' 的匹配构造函数>
- 在C#WPF应用程序中使用C++11库的选项是什么
- Netbeans 7.2 中 c++ "-std=c++11"无法识别的命令行选项
- makefile 不适用于 -std=c++11 选项
- Scons 选择哪个版本的 g++ |无法识别的命令行选项"-std=c++11"
- 如果我使用c++11功能编译一个文件,同时将其链接到一个没有c++11编译器选项编译的库,会有什么问题吗
- 编译器选项不适用于无序集C++11功能
- 无法识别的命令行选项'-std=c++11'
- 用于链接的VC 11.0命令链接选项是什么
- 特征C++库给出了C++11选项的错误
- 使用-Wpedantic选项编译c++ 11:是否有一个选项可以只禁用关于未命名结构的警告
- clang++只在删除-std=c++11选项时使用boost::format编译c++11程序
- 如何在C++11中使用SFINAE从多个选项中选择构造函数
- cc1plus:错误:使用 g++ 无法识别的命令行选项"-std=c++11"