Reputation: 1
I created a learning project with this directory structure:
top_srcdir
/ \
src build
/ \
src1 src2
Directory src contains file main.c with this content:
#include "src1/foo.h"
#include "src2/bar.h"
int main()
{
foo();
bar();
return 0;
}
src/src1/foo.c contains:
#include "src1/foo.h"
//some code
src/src2/bar.c contains:
#include "src2/bar.h"
//some code
Makefile.am contains:
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
../src/src1/foo.c fatal error: src1/foo.h: No such file or directory.
What value should I provide for variable AM_CPPFLAGS
so that this error does not occur?
Upvotes: 0
Views: 87
Reputation: 16315
You really don't need to set AM_CPPFLAGS:
bin_PROGRAMS = sample
sample_SOURCES = src/main.c src/src1/foo.c src/src2/bar.c
sample_CPPFLAGS = -I src
Should work.
Upvotes: 2