我试图在Windows上使用Dev-C ++的Eigen库。我正在使用“入门”计划:
#include <iostream>
#include <Eigen/Dense>
using Eigen::MatrixXd;
int main()
{
MatrixXd m(2,2);
m(0,0) = 3;
m(1,0) = 2.5;
m(0,1) = -1;
m(1,1) = m(1,0) + m(0,1);
std::cout << m << std::endl;
}
但是我获得了以下编译日志:
编译器:默认编译器 构建Makefile:“C:\ Dev-Cpp \ tsesn \ Makefile.win” 执行make ... make.exe -f“C:\ Dev-Cpp \ tsesn \ Makefile.win”全部 g ++。exe -c main.cpp -o main.o -I“C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include”-I“C:/ Dev-Cpp / include / c ++ / 3.4 .2 /后退“-I”C:/ Dev-Cpp / include / c ++ / 3.4.2 / mingw32“-I”C:/ Dev-Cpp / include / c ++ / 3.4.2“-I”C:/ Dev -Cpp /包括“-I”C:/ Dev-Cpp / eigen“
包含在C:/ Dev-Cpp / eigen / Eigen / Core中的文件:287,
来自C:/ Dev-Cpp / eigen / Eigen / Dense:1,
来自main.cpp:2:
C:/Dev-Cpp/eigen/Eigen/src/Core/util/Memory.h:在函数void* Eigen::internal::aligned_malloc(size_t)':
C:/Dev-Cpp/eigen/Eigen/src/Core/util/Memory.h:228: error:
_ aligned_malloc'未声明(首先使用此函数)
C:/Dev-Cpp/eigen/Eigen/src/Core/util/Memory.h:228:错误:(每个未声明的标识符仅针对它出现的每个函数报告一次。)
C:/Dev-Cpp/eigen/Eigen/src/Core/util/Memory.h:在函数void Eigen::internal::aligned_free(void*)':
C:/Dev-Cpp/eigen/Eigen/src/Core/util/Memory.h:251: error:
_ aligned_free'未声明(首先使用此函数)
C:/Dev-Cpp/eigen/Eigen/src/Core/util/Memory.h:函数void* Eigen::internal::aligned_realloc(void*, size_t, size_t)':
C:/Dev-Cpp/eigen/Eigen/src/Core/util/Memory.h:283: error:
_ aligned_realloc'未声明(首先使用此函数)
包含在C:/ Dev-Cpp / eigen / Eigen / Core中的文件:343,
来自C:/ Dev-Cpp / eigen / Eigen / Dense:1,
来自main.cpp:2:
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:在全球范围内:
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:39:错误:在“bool”之前预期的primary-expression
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:39:错误:期望>' before "bool"
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:56: error: template argument 5 is invalid
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:56: error:
值'不是<declaration error>'
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:65: error: template argument 5 is invalid
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:65: error:
值的成员'不是''的成员
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:207:错误:模板参数4无效
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:207:错误:ISO C ++禁止声明m_data' with no type
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h: In member function
const T * Eigen :: DenseStorage :: data()const':
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:227:错误:array' has not been declared
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:227: error: request for member of non-aggregate type before ';' token
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h: In member function
T * Eigen :: DenseStorage :: data()':
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:228:错误:`array'尚未声明
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:228:错误:在';'之前请求非聚合类型的成员代币
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:在全球范围内:
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:262:错误:模板参数4无效
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:262:错误:ISO C ++禁止声明m_data' with no type
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h: In member function
const T * Eigen :: DenseStorage :: data()const':
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:287:错误:array' has not been declared
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:287: error: request for member of non-aggregate type before ';' token
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h: In member function
T * Eigen :: DenseStorage :: data()':
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:288:错误:array' has not been declared
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:288: error: request for member of non-aggregate type before ';' token
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h: At global scope:
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:294: error: template argument 4 is invalid
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:294: error: ISO C++ forbids declaration of
m_data'没有类型
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:在成员函数const T* Eigen::DenseStorage<T, Size, -0x000000001, _Cols, _Options>::data() const':
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:316: error:
数组'尚未声明
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:316:错误:在';'之前请求非聚合类型的成员代币
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:在成员函数`T * Eigen :: DenseStorage :: data()':
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:317:错误:`array'尚未声明 C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:317:错误:在';'之前请求非聚合类型的成员令牌
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:在全球范围内: C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:323:错误:模板参数4无效 C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:323:错误:ISO C ++禁止声明`m_data'没有类型
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:在成员函数const T* Eigen::DenseStorage<T, Size, _Rows, -0x000000001, _Options>::data() const':
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:345: error:
数组'尚未声明
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:345:错误:在';'之前请求非聚合类型的成员代币
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:在成员函数T* Eigen::DenseStorage<T, Size, _Rows, -0x000000001, _Options>::data()':
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:346: error:
数组'尚未声明
C:/Dev-Cpp/eigen/Eigen/src/Core/DenseStorage.h:346:错误:在';'之前请求非聚合类型的成员令牌
C:/Dev-Cpp/eigen/Eigen/src/Core/PlainObjectBase.h:254:被先前的错误搞糊涂,拯救
make.exe:*** [main.o]错误1
执行终止
我该如何解决这个问题?
答案 0 :(得分:0)
我担心Dev-C ++(http://www.bloodshed.net/dev/devcpp.html)中的编译器很古老,并且不受Eigen(http://eigen.tuxfamily.org/index.php?title=Main_Page#Compiler_support)的支持。请注意那里的版本号。
您可以使用更现代的IDE,例如QtCreator(http://wiki.qt.io/Category:Tools::QtCreator),或任何其他提供更新的兼容编译器的IDE。