Error in Makefile: gcc: error: filename.o :No such file or directory found

Error in Makefile: gcc: error: filename.o :No such file or directory found

我有以下生成文件,但编译时出现错误:找不到这样的文件或目录。 这是我要执行的生成文件: P.S。我正在尝试在 Linux 和 windows 上执行此操作,但我在两者上都遇到了同样的错误。

CC = gcc
#LFLAG = 
CFLAGS = -Wall -g -O4 -DWMOPS=0 -D__MSDOS__

# Objects
OBJ =  coder.o agc2.o autocorr.o az_isp.o bits.o c2t64fx.o c4t64fx.o cod_main.o \
    convolve.o cor_h_x.o d2t64fx.o d4t64fx.o decim54.o dec_main.o deemph.o \
    dtx.o d_gain2.o gpclip.o g_pitch.o hp6k.o hp7k.o hp50.o hp400.o hp_wsp.o \
    int_lpc.o isfextrp.o isp_az.o isp_isf.o lagconc.o lag_wind.o levinson.o \
    lp_dec2.o math_op.o ph_disp.o pitch_f4.o pit_shrp.o pred_lt4.o preemph.o \
    p_med_ol.o qisf_ns.o qpisf_2s.o q_gain2.o q_pulse.o random.o residu.o \
    scale.o syn_filt.o updt_tar.o util.o voicefac.o wb_vad.o weight_a.o \
    basicop2.o count.o log2.o oper_32b.o homing.o \

DOBJ =  decoder.o agc2.o autocorr.o az_isp.o bits.o c2t64fx.o c4t64fx.o cod_main.o \
    convolve.o cor_h_x.o d2t64fx.o d4t64fx.o decim54.o dec_main.o deemph.o \
    dtx.o d_gain2.o gpclip.o g_pitch.o hp6k.o hp7k.o hp50.o hp400.o hp_wsp.o \
    int_lpc.o isfextrp.o isp_az.o isp_isf.o lagconc.o lag_wind.o levinson.o \
    lp_dec2.o math_op.o ph_disp.o pitch_f4.o pit_shrp.o pred_lt4.o preemph.o \
    p_med_ol.o qisf_ns.o qpisf_2s.o q_gain2.o q_pulse.o random.o residu.o \
    scale.o syn_filt.o updt_tar.o util.o voicefac.o wb_vad.o weight_a.o \
    basicop2.o count.o log2.o oper_32b.o homing.o \

# Implicit Rules
.c.o:
    $(CC) $(CFLAGS)  -c  $<

all:    coder decoder

# Explicit Rules
coder:    $(OBJ)
    $(CC) $(CFLAGS) -o coder $(OBJ)
decoder:  $(DOBJ)
    $(CC) $(CFLAGS) -o decoder $(DOBJ)

# Individual File Dependencies

basicop2.o: typedef.h basic_op.h count.h
count.o:    typedef.h count.h
log2.o:     log2.h typedef.h basic_op.h count.h log2_tab.h
oper_32b.o: typedef.h basic_op.h oper_32b.h count.h
autocorr.o: typedef.h basic_op.h oper_32b.h acelp_fx.h count.h
az_isp.o:   typedef.h basic_op.h oper_32b.h count.h
bits.o:     typedef.h basic_op.h cnst_fx.h bits_fx.h acelp_fx.h count.h dtx_fx.h
c2t64fx.o:  typedef.h basic_op.h math_op.h acelp_fx.h count.h cnst_fx.h
c4t64fx.o:  typedef.h basic_op.h math_op.h acelp_fx.h count.h cnst_fx.h q_pulse_fx.h
cod_main.o: typedef.h basic_op.h oper_32b.h math_op.h cnst_fx.h acelp_fx.h \
    cod_main_fx.h bits_fx.h count.h
convolve.o: typedef.h basic_op.h count.h
cor_h_x.o:  typedef.h basic_op.h math_op.h count.h
d2t64fx.o:  typedef.h basic_op.h count.h cnst_fx.h
d4t64fx.o:  typedef.h basic_op.h count.h cnst_fx.h q_pulse_fx.h
decim54.o:  typedef.h basic_op.h acelp_fx.h count.h cnst_fx.h
dec_main.o: typedef.h basic_op.h oper_32b.h cnst_fx.h acelp_fx.h dec_main_fx.h  bits_fx.h  count.h  math_op.h 
deemph.o:   typedef.h basic_op.h math_op.h count.h
dtx.o:      typedef.h basic_op.h oper_32b.h math_op.h cnst_fx.h acelp_fx.h bits_fx.h dtx_fx.h count.h log2.h
d_gain2.o:  typedef.h basic_op.h oper_32b.h math_op.h log2.h cnst_fx.h acelp_fx.h count.h 
gpclip.o:   typedef.h basic_op.h count.h 
g_pitch.o:  typedef.h basic_op.h math_op.h count.h 
homing.o:   typedef.h basic_op.h cnst_fx.h bits_fx.h
hp400.o:    typedef.h basic_op.h oper_32b.h acelp_fx.h count.h 
hp50.o:     typedef.h basic_op.h oper_32b.h cnst_fx.h acelp_fx.h count.h 
hp6k.o:     typedef.h basic_op.h acelp_fx.h count.h cnst_fx.h 
hp_wsp.o:   typedef.h basic_op.h oper_32b.h acelp_fx.h count.h 
int_lpc.o:  typedef.h basic_op.h cnst_fx.h acelp_fx.h count.h 
isfextrp.o: typedef.h basic_op.h oper_32b.h cnst_fx.h acelp_fx.h count.h 
isp_az.o:   typedef.h basic_op.h oper_32b.h count.h cnst_fx.h 
isp_isf.o:  typedef.h basic_op.h count.h 
lagconc.o:  typedef.h basic_op.h count.h cnst_fx.h acelp_fx.h 
lag_wind.o: typedef.h basic_op.h oper_32b.h 
levinson.o: typedef.h basic_op.h oper_32b.h acelp_fx.h count.h 
lp_dec2.o:  typedef.h basic_op.h count.h cnst_fx.h 
math_op.o:  typedef.h basic_op.h math_op.h count.h 
ph_disp.o:  typedef.h basic_op.h cnst_fx.h acelp_fx.h count.h 
pitch_f4.o: typedef.h basic_op.h math_op.h acelp_fx.h cnst_fx.h count.h 
pit_shrp.o: typedef.h basic_op.h count.h 
pred_lt4.o: typedef.h basic_op.h count.h 
preemph.o:  typedef.h basic_op.h count.h 
p_med_ol.o: typedef.h basic_op.h acelp_fx.h oper_32b.h count.h math_op.h 
qisf_ns.o:  typedef.h basic_op.h acelp_fx.h count.h 
qpisf_2s.o: typedef.h basic_op.h cnst_fx.h acelp_fx.h count.h 
q_gain2.o:  typedef.h basic_op.h oper_32b.h math_op.h count.h log2.h acelp_fx.h 
q_pulse.o:  typedef.h basic_op.h count.h q_pulse_fx.h 
random.o:   typedef.h basic_op.h count.h 
residu.o:   typedef.h basic_op.h count.h 
scale.o:    typedef.h basic_op.h count.h 
syn_filt.o: typedef.h basic_op.h math_op.h count.h cnst_fx.h 
updt_tar.o: typedef.h basic_op.h count.h 
util.o:     typedef.h basic_op.h count.h 
voicefac.o: typedef.h basic_op.h math_op.h count.h 
wb_vad.o:   cnst_fx.h wb_vad_fx.h typedef.h basic_op.h count.h math_op.h wb_vad_c_fx.h 
weight_a.o: typedef.h basic_op.h count.h 
agc2.o:     cnst_fx.h acelp_fx.h typedef.h basic_op.h count.h math_op.h 
hp7k.o:     typedef.h basic_op.h cnst_fx.h acelp_fx.h count.h 
decoder.o:  typedef.h basic_op.h acelp_fx.h cnst_fx.h main.h bits_fx.h dtx_fx.h count.h 
coder.o:    typedef.h basic_op.h acelp_fx.h cnst_fx.h cod_main_fx.h bits_fx.h   count.h cod_main_fx.h 

我得到的确切错误是:

make -f makefile.gcc
gcc -Wall -g -O4 -DWMOPS=0 -D__MSDOS__ -o coder coder.o agc2.o autocorr.o az_isp.o bits.o c2t64fx.o c4t64fx.o cod_main.o convolve.o cor_h_x.o d2t64fx.o d4t64fx.o decim54.o dec_main.o deemph.o dtx.o d_gain2.o gpclip.o g_pitch.o hp6k.o hp7k.o hp50.o hp400.o hp_wsp.o int_lpc.o isfextrp.o isp_az.o isp_isf.o lagconc.o lag_wind.o levinson.o lp_dec2.o math_op.o ph_disp.o pitch_f4.o pit_shrp.o pred_lt4.o preemph.o p_med_ol.o qisf_ns.o qpisf_2s.o q_gain2.o q_pulse.o random.o residu.o scale.o syn_filt.o updt_tar.o util.o voicefac.o wb_vad.o weight_a.o basicop2.o count.o log2.o oper_32b.o homing.o 
gcc: error: coder.o: No such file or directory
gcc: error: agc2.o: No such file or directory
gcc: error: autocorr.o: No such file or directory
gcc: error: az_isp.o: No such file or directory
gcc: error: bits.o: No such file or directory
gcc: error: c2t64fx.o: No such file or directory
gcc: error: c4t64fx.o: No such file or directory
gcc: error: cod_main.o: No such file or directory
gcc: error: convolve.o: No such file or directory
gcc: error: cor_h_x.o: No such file or directory
gcc: error: d2t64fx.o: No such file or directory
gcc: error: d4t64fx.o: No such file or directory
gcc: error: decim54.o: No such file or directory
gcc: error: dec_main.o: No such file or directory
gcc: error: deemph.o: No such file or directory
gcc: error: dtx.o: No such file or directory
gcc: error: d_gain2.o: No such file or directory
gcc: error: gpclip.o: No such file or directory
gcc: error: g_pitch.o: No such file or directory
gcc: error: hp6k.o: No such file or directory
gcc: error: hp7k.o: No such file or directory
gcc: error: hp50.o: No such file or directory
gcc: error: hp400.o: No such file or directory
gcc: error: hp_wsp.o: No such file or directory
gcc: error: int_lpc.o: No such file or directory
gcc: error: isfextrp.o: No such file or directory
gcc: error: isp_az.o: No such file or directory
gcc: error: isp_isf.o: No such file or directory
gcc: error: lagconc.o: No such file or directory
gcc: error: lag_wind.o: No such file or directory
gcc: error: levinson.o: No such file or directory
gcc: error: lp_dec2.o: No such file or directory
gcc: error: ph_disp.o: No such file or directory
gcc: error: pitch_f4.o: No such file or directory
gcc: error: pit_shrp.o: No such file or directory
gcc: error: pred_lt4.o: No such file or directory
gcc: error: preemph.o: No such file or directory
gcc: error: p_med_ol.o: No such file or directory
gcc: error: qisf_ns.o: No such file or directory
gcc: error: qpisf_2s.o: No such file or directory
gcc: error: q_gain2.o: No such file or directory
gcc: error: q_pulse.o: No such file or directory
gcc: error: random.o: No such file or directory
gcc: error: residu.o: No such file or directory
gcc: error: scale.o: No such file or directory
gcc: error: syn_filt.o: No such file or directory
gcc: error: updt_tar.o: No such file or directory
gcc: error: util.o: No such file or directory
gcc: error: voicefac.o: No such file or directory
gcc: error: wb_vad.o: No such file or directory
gcc: error: weight_a.o: No such file or directory
gcc: error: homing.o: No such file or directory
make: *** [coder] Error 1

编译器找不到目标文件,因为它们不是构建的。并且目标文件没有构建,因为源在不同的目录中(例如 src)或者由于其他原因 make 看不到它们。


我用 --debug

对此进行了更多调查
make --debug=v -f makefile.gcc

并获得

Reading makefiles...
Reading makefile `makefile.gcc'...
Updating goal targets....
Considering target file `all'.
File `all' does not exist.
Considering target file `coder'.
File `coder' does not exist.
Considering target file `coder.o'.
File `coder.o' does not exist.
Considering target file `typedef.h'.
Finished prerequisites of target file `typedef.h'.
No need to remake target `typedef.h'.
Considering target file `basic_op.h'.
Finished prerequisites of target file `basic_op.h'.
No need to remake target `basic_op.h'.
...
Considering target file `count.h'.
Finished prerequisites of target file `count.h'.
No need to remake target `count.h'.
Pruning file `cod_main_fx.h'.
Finished prerequisites of target file `coder.o'.
Must remake target `coder.o'.
Successfully remade target file `coder.o'.
Considering target file `agc2.o'.
File `agc2.o' does not exist.
Pruning file `cnst_fx.h'.
Pruning file `acelp_fx.h'.
Pruning file `typedef.h'.
Pruning file `basic_op.h'.
...
Finished prerequisites of target file `homing.o'.
Must remake target `homing.o'.
Successfully remade target file `homing.o'.
Finished prerequisites of target file `coder'.
Must remake target `coder'.
gcc -Wall -g -O4 -DWMOPS=0 -D__MSDOS__ -o coder coder.o agc2.o autocorr.o ...
gcc: error: coder.o: No such file or directory
gcc: error: agc2.o: No such file or directory
gcc: error: autocorr.o: No such file or directory

由于头文件依赖性,make 认为它已经正确地重新制作目标文件目标,即使它没有看到源文件。

如果您提供源文件(即使是空文件),输出看起来会有点不同

...
Finished prerequisites of target file `coder.o'.
Must remake target `coder.o'.
gcc -Wall -g -O4 -DWMOPS=0 -D__MSDOS__ -c coder.c
Successfully remade target file `coder.o'.
Considering target file `agc2.o'.
File `agc2.o' does not exist.
Pruning file `cnst_fx.h'.
...

在这里您可以看到,make 如何检查所有先决条件,然后使用 makefile 中给出的隐式规则重建目标文件。

您可以通过将源文件明确列为依赖项来避免 make 的混淆,例如

coder.o: coder.c

Make 将在不调用 link 命令的情况下抱怨缺少源文件

make: *** No rule to make target `coder.c', needed by `coder.o'. Stop.