2016-12-31 57 views
1

我创建了一个新的C++中VS2015(空)的项目,然后放置在本征3.3.1源代码中的“INC”文件夹中的溶液dir,例如,Matrix.h的路径是inc/Eigen/Core/。我已经将这个INC/路径作为一个附加的包含目录,并试图与INC /本征/作为另一个include目录的情况下,这些文件有问题,其中包括对方,但是这什么也没有改变。包括在新鲜Visual Studio项目任何本征3.3.1文件不会编译

在main.cpp中,我有以下几点:

#include "Eigen/Core/Matrix.h" 

int main() 
{ 
    return 0; 
} 

这给我,编译为64时:

1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(18): error C2988: unrecognizable template declaration/definition 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(18): error C2143: syntax error: missing ';' before '<' 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(18): error C2059: syntax error: '<' 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(19): error C2143: syntax error: missing ';' before '{' 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(19): error C2447: '{': missing function header (old-style formal list?) 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(179): error C2143: syntax error: missing ',' before '<' 
1> c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(404): note: see reference to class template instantiation 'Eigen::Matrix<_Scalar,_Rows,_Cols,_Options,_MaxRows,_MaxCols>' being compiled 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(186): error C2143: syntax error: missing ';' before '<' 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(186): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(186): error C2238: unexpected token(s) preceding ';' 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(192): error C2653: 'Base': is not a class or namespace name 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(192): error C2144: syntax error: 'int' should be preceded by ';' 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(192): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(192): warning C4183: 'EIGEN_DENSE_PUBLIC_INTERFACE': missing return type; assumed to be a member function returning 'int' 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(192): error C3646: 'PlainObject': unknown override specifier 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(194): error C2653: 'Base': is not a class or namespace name 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(195): error C2653: 'Base': is not a class or namespace name 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(206): error C3646: 'EIGEN_STRONG_INLINE': unknown override specifier 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(206): error C3646: 'Matrix': unknown override specifier 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(206): error C2143: syntax error: missing ';' before '&' 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(206): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(207): error C2334: unexpected token(s) preceding '{'; skipping apparent function body 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(223): error C2061: syntax error: identifier 'EIGEN_STRONG_INLINE' 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(237): error C2334: unexpected token(s) preceding '{'; skipping apparent function body 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(243): error C2061: syntax error: identifier 'EIGEN_STRONG_INLINE' 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(259): error C2334: unexpected token(s) preceding ':'; skipping apparent function body 
1>c:\users\brody\documents\visual studio 2015\projects\eigentest\inc\eigen\core\matrix.h(14): fatal error C1075: the left brace '{' was unmatched at the end of the file 

哪个抱怨Matrix.h的第18行:

#ifndef EIGEN_MATRIX_H 
#define EIGEN_MATRIX_H 

namespace Eigen { 

namespace internal { 
template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols> 
struct traits<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > // line 18 
{ 
private: 
// etc... 

类似的问题发生在任何其他特征#include。我错过了一些必需的#include命令或一些编译标志或设置吗?谢谢!

回答

0

您必须复制整个Eigen目录,而不仅仅是src子文件夹。并且您不能直接包含src子文件夹中的文件,但在Eigen目录中包含这些文件。例如,#include <Eigen/Core>将包括所有核心功能,#include <Eigen/Dense>将包括所有密功能(这包括核心,几何构型和分解)。