1
我知道這個makefile文件非常簡單,但我一直在閱讀一些教程和示例,試圖學習它並應用。 我所展示的內容是否有問題,或者應該與我展示的內容一起使用?具有多個文件和依賴性的makefile文件
所有文件都位於運行make的CWD
中。
這是我的依賴項列表。
CT.c includes: studio.h, math.h, "CT.h", "TM.h"
CT.h includes: none
TM.c includes: "TM.h", stdio.h, math.h
TM.h includes: none
RP.c includes: "CT.h", math.h, fftw3.h, stdio.h, stdlib.h, "TM.h"
RP.h includes: fftw3.h
RF.c includes: "RF.h", stdlib.h, stdio.h
RF.h includes: none
DR.c includes: stdio.h, math.h, "DR.h"
main.c includes: "CT.h", "DR.h", "TM.h", "RP.h", "RF.h", stdio.h, math.h, time.h, stdlib.h, fftw3.h
這裏是我的makefile不工作:
RFST: main.o CT.o TM.o RP.o RF.o DR.o
gcc -L/home/me/projects/RFST/libs -o RFST main.o CT.o TM.o RP.o RF.o DR.o -lfftw3 -lasc -lmfhdf -ldf -lz -ljeg -lm
main.o: main.c CT.h TM.h RP.h RF.h DR.h
gcc -I. -c main.c
CT.o: CT.c CT.h TM.h
gcc -I. -c CT.c
TM.o: TM.c TM.h
gcc -I. -c TM.c
RP.o: RP.c RP.h CT.h TM.h
gcc -I. -c RP.c
RF.o: RF.c RF.h
gcc -I. -c RF.c
DR.o: DR.c DR.h
gcc -I. -c DR.c
當嘗試運行它抱怨,事情並沒有宣佈makefile文件,但所有這些東西都在聲明包含的各種頭文件。
實施例:
'vA' undeclared(first use in this function)
'Variables' undeclared(first use in this funcion)
Variables vA[];
是在main.c中 Variables
是struct
的DR.h
,它被包含在main.c中。
你的錯誤信息是? – gongzhitaao
爲什麼.h文件在需要的列表中?如果頭文件丟失,您的.c文件將無法編譯。 – doptimusprime
@ gongzhitaao,添加示例錯誤。 – prolink007