Reputation: 13
I am currently working on an assignment that requires me to build a Makefile that
So I have most of the coding down for this, but I keep getting errors for when i try to put the .o's for the trig functions in the include folder. The error is
trig/cos330.c:1:10: fatal error: 'math330.h' file not found
This is just the last part i need help with! Can someone give me hints about what I can do? Thanks!
all:
mkdir -p ./include
mkdir -p ./lib
cp math330.h ./include
gcc -l ./include/ -c trig/*.c
gcc -l ./include/ -c exp/*.c
mv *.o ./lib/
ar r libmath.a lib/*
mv libmath.a lib/
gcc -l ./include/ cli/cli.c -L ./lib -lmath -lm
clean:
rm -rf include
rm -rf lib
rm a.out
Upvotes: 0
Views: 1589
Reputation: 754570
The option to specify an include directory is capital-I (I
), not lower-case L (l
).
gcc -I ./include …
The lower-case ell indicates a library name. Given -l ./include
, the poor linker would have a schizophrenic time looking for a library lib./include.a
or lib./include.so
to link with (possibly in the ./lib
directory), and it probably wouldn't find it. But it doesn't get that far.
Upvotes: 1