无法同时包含Eigen和boost/regex。

4

我可以单独包含每个库,但是一旦尝试同时包含它们,就会出现大量错误。我正在使用Boost v1_55_0和Eigen v3.2.1。有任何想法可能是什么问题吗?

我的包含看起来像这样:

#include <boost/regex.hpp>
#include <Eigen>

我粘贴了前几个错误,总共有100多个。

Error   1   error C1189: #error :  The Eigen/Array header does no longer exist in Eigen3. All that functionality has moved to Eigen/Core.   c:\local\eigen\array    8   1   Project1
2   IntelliSense: #error directive: The Eigen/Array header does no longer exist in Eigen3. All that functionality has moved to Eigen/Core.  c:\local\Eigen\Array    8   4   Project1
3   IntelliSense: expected a declaration    c:\local\boost_1_55_0\boost\functional\hash\extensions.hpp  160 13  Project1
4   IntelliSense: expected a declaration    c:\local\boost_1_55_0\boost\functional\hash\extensions.hpp  162 5   Project1
5   IntelliSense: expected a declaration    c:\local\boost_1_55_0\boost\functional\hash\extensions.hpp  377 1   Project1
6   IntelliSense: expected a declaration    c:\local\boost_1_55_0\boost\regex\v4\basic_regex.hpp    59  7   Project1
7   IntelliSense: expected a declaration    c:\local\boost_1_55_0\boost\regex\v4\basic_regex.hpp    100 7   Project1
8   IntelliSense: identifier "name" is undefined    c:\local\boost_1_55_0\boost\regex\v4\basic_regex.hpp    108 24  Project1
9   IntelliSense: explicit type is missing ('int' assumed)  c:\local\boost_1_55_0\boost\regex\v4\basic_regex.hpp    111 4   Project1
10  IntelliSense: a type qualifier is not allowed on a nonmember function   c:\local\boost_1_55_0\boost\regex\v4\basic_regex.hpp    136 21  Project1
11  IntelliSense: a type qualifier is not allowed on a nonmember function   c:\local\boost_1_55_0\boost\regex\v4\basic_regex.hpp    146 33  Project1
12  IntelliSense: expected a declaration    c:\local\boost_1_55_0\boost\regex\v4\basic_regex.hpp    151 1   Project1
13  IntelliSense: expected a declaration    c:\local\boost_1_55_0\boost\regex\v4\basic_regex.hpp    153 1   Project1

我不能具体说,但基本上你已经设置了项目包含boost regex和eigen的目录,并且它们有一个同名的文件,所以它会混淆。我想是这样。 - David
你的包含文件长什么样? - Alan Stokes
我把它们放到了问题中。 - Silvester
1个回答

5
Boost 包含了 C++11 的 std::array 头文件 array,但是你的包含路径选择了来自 Eigen 的Array头文件(显然已经过时)。你可能在一个不区分大小写的文件系统上。
正确包含 Eigen 头文件的方法如下:
#include <Eigen/Eigen>

例如,请参见入门示例。您应该修改您的包含路径,以使用包含Eigen/头文件目录的目录,而不是将Eigen/目录放在包含路径上。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接