c++ - 不能同时包含 Eigen 和 boost/regex

标签 c++ regex boost eigen

我可以单独包含每个库,但是一旦我尝试同时包含它们,就会出现大量错误。我正在使用 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 包括 C++11 std::array header array 但您的包含路径正在从 Eigen 中获取 Array header (显然已过时)。您必须在不区分大小写的文件系统上。

似乎包含 Eigen header 的正确方法是:

#include <Eigen/Eigen>

例如参见 Getting Started sample .您应该修改包含路径以使用包含 Eigen/ header 目录的目录,而不是将 Eigen/ 目录放在包含路径上。

关于c++ - 不能同时包含 Eigen 和 boost/regex,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24099246/

相关文章:

java - 如何从这样的字符串中提取 double

regex - 如何为复杂的印度尼西亚电话号码格式构建正则表达式?

c++ - substr C++ 的多个元素

c++ - 代码 “Undefined symbols for architecture x86_64”

c++ - SFINAE 重复构造函数声明

javascript - Jquery 仅在按键时允许字符之间有空白

c++ - 类继承层次结构设计问题

boost - Boost.Graph 中的 boost::out_edges( v, g ) 有什么作用?

c++ - 如何从套接字读取中接收自定义数据类型?

c++ - Linux 上的 Boost 和 ssl 客户端服务器构建问题