"致命错误:boost / regex.hpp:没有这样的文件或目录"尝试使用makefile

时间:2017-05-03 19:24:54

标签: c++ macos boost makefile macos-sierra

我正在尝试编译一个名为"SPECIES Identification of Taxonomic Mentions in Text"的开源软件。 我在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目录放入包含源代码的目录中(它不起作用)。

有任何建议/帮助吗?

1 个答案:

答案 0 :(得分:1)

您需要告诉编译器在哪里找到boost标头。

您需要使用include path选项指定可以找到boost标头的位置,使用-I/path/to/boost/include

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