"fatal error: boost/regex.hpp: No such file or directory" when trying to compile C++ program using a makefile

"fatal error: boost/regex.hpp: No such file or directory" when trying to compile C++ program using a makefile

我正在尝试编译一个名为 "SPECIES" 的开源软件 识别文本中的分类提及我在 MacOS

我下载了源代码(可以在here找到),移动到目录中并使用命令make编译。这是返回的错误:

g++ -fpic -pthread -Wall -O3 -o organisms organisms.cxx -lm -lboost_regex
In file included from batch_tagger.h:5:0,
                 from organisms.cxx:3:
tagger.h:7:27: fatal error: boost/regex.hpp: No such file or directory
compilation terminated.
make: *** [organisms] Error 1

我使用 brew install boost 安装了 C++ boost 库 并再次尝试了上述步骤(它不起作用)。

我尝试将 boost 目录放到包含源代码的目录中(它不起作用)。

任何suggestions/help?

你需要告诉编译器在哪里可以找到 boost headers。

您需要使用包含路径选项来指定在哪里可以找到 boost headers,请使用 -I/path/to/boost/include.

然后使用代码中的 #include <boost/regex.hpp> 包含文件。