c++ - 设置了 CPPFLAGS 但仍未找到 header

标签 c++ compilation configure autoconf openfst

我用 ./configure 设置了 CPPFLAGS 和 LDFLAGS,但是仍然找不到头文件 fst.h。尽管它位于 CPPFLAGS 目录中指定的位置。

./configure CPPFLAGS=-I/Users/username/Downloads/openfst-1.5.1/src/include LDFLAGS=-L/Users/username/Downloads/openfst-1.5.1/src/lib

...

checking for stdint.h... yes
checking for unistd.h... yes
checking fst/fst.h usability... no
checking fst/fst.h presence... no
checking for fst/fst.h... no
configure: error: Required file fst/fst.h not found -- aborting

我错过了什么?

最佳答案

您实际上并没有设置 configure 脚本检查的 CPPFLAGS 环境变量,但是您传递了 CPPFLAGS=-I/Users/username/Downloads/openfst-1.5.1/src/include 作为脚本的参数。与 LDFLAGS 相同。

您应该在脚本之前将它们设置为环境变量,例如

CPPFLAGS=-I/Users/username/Downloads/openfst-1.5.1/src/include LDFLAGS=-L/Users/username/Downloads/openfst-1.5.1/src/lib ./configure

使用续行可以更轻松地同时查看所有内容:

CPPFLAGS=-I/Users/username/Downloads/openfst-1.5.1/src/include \
LDFLAGS=-L/Users/username/Downloads/openfst-1.5.1/src/lib \
./configure

关于c++ - 设置了 CPPFLAGS 但仍未找到 header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36794329/

相关文章:

python - Cx_Freeze 构建不包括 zip 文件中的 python 库

compilation - 如何在编译环境中使用鸡蛋?

编译器看不到的常量

C++ 生成警告 : dereferencing type-punned pointer will break strict-aliasing rules

c++ - 在 C++ 中转换类型时出错

c++ - 如何从 qml 访问 qabstractlistmodel 派生类对象作为另一个类的属性?

c++ - 使用 GetDIBits 加载位图

C——汇编消息

android - 构建 libtool-2.2.4 时系统 androideabi 无法识别

compilation - 无法编译 gearman - 配置脚本失败