[英]Howto set in the Autotools include paths?
I created a learning project with this directory structure: 我使用以下目录结构创建了一个学习项目:
top_srcdir
/ \
src build
/ \
src1 src2
Directory src contains file main.c with this content: 目录src包含文件main.c,内容如下:
#include "src1/foo.h"
#include "src2/bar.h"
int main()
{
foo();
bar();
return 0;
}
src/src1/foo.c contains: src / src1 / foo.c包含:
#include "src1/foo.h"
//some code
src/src2/bar.c contains: src / src2 / bar.c包含:
#include "src2/bar.h"
//some code
Makefile.am contains: Makefile.am包含:
bin_PROGRAMS = sample
sample_SOURCES = src/main.c src/src1/foo.c src/src2/bar.c
When I change the woring directory to build
and execute ../configure && make
, the make
step fails with 当我更改工作目录以build
并执行../configure && make
, make
步骤将失败并显示
../src/src1/foo.c fatal error: src1/foo.h: No such file or directory. ../src/src1/foo.c致命错误:src1 / foo.h:没有这样的文件或目录。
What value should I provide for variable AM_CPPFLAGS
so that this error does not occur? 我应该为变量AM_CPPFLAGS
提供什么值,以便不会发生此错误?
You really don't need to set AM_CPPFLAGS: 您确实不需要设置AM_CPPFLAGS:
bin_PROGRAMS = sample
sample_SOURCES = src/main.c src/src1/foo.c src/src2/bar.c
sample_CPPFLAGS = -I src
Should work. 应该管用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.