gpt4 book ai didi

c - makefile 编译目标文件没有规则

转载 作者:太空宇宙 更新时间:2023-11-04 03:54:23 24 4
gpt4 key购买 nike

我的 makefile 正在编译 write_time.o 尽管我没有给它任何规则。但是,当我实际为它编写规则时,它不会编译。关于什么可能导致此问题的任何建议?下面是我的生成文件:

INCLUDES = -I../include -I/opt/local/include
CC = gcc

OBJS = image_io.o xcorr.o textfile_io.o main.o array_processing.o \
fit2d.o poly.o mattran.o matsolve.o nelder_mead.o process.o \
open_seq_file.o write_time.o close_seq_file.o

DEBUGS = -g
CFLAGS = $(INCLUDES) -Wall -O2 $(DEBUGS)
DESTDIR = ../bin
LDFLAGS = -L. -L/opt/local/lib -ltiff -lm -L../lib -lmatrix ../include/seq_io.h
DEPS = ../include/file_io.h ../include/corr.h \
../include/matrix.h /opt/local/include/tiffio.h \
/opt/local/include/tiff.h ../include/seq_io.h
#../include/nmsimplex.h

all: $(DESTDIR)/main

image_io.o: image_io.c ../include/file_io.h /opt/local/include/tiffio.h \
/opt/local/include/tiff.h
$(CC) $(CFLAGS) -o $@ -c $<

xcorr.o: xcorr.c ../include/file_io.h
$(CC) $(CFLAGS) -o $@ -c $<

textfile_io.o: textfile_io.c ../include/file_io.h
$(CC) $(CFLAGS) -o $@ -c $<

array_processing.o: array_processing.c ../include/file_io.h
$(CC) $(CFLAGS) -o $@ -c $<

fit2d.o: fit2d.c ../include/matrix.h
$(CC) $(CFLAGS) -o $@ -c $<

poly.o: poly.c ../include/corr.h
$(CC) $(CFLAGS) -o $@ -c $<

nelder_mead.o: nelder_mead.c ../include/corr.h
$(CC) $(CFLAGS) -o $@ -c $<
# nmsimplex.o: nmsimplex.c ../include/nmsimplex.h
# $(CC) $(CFLAGS) -o $@ -c $<
process.o: process.c ../include/corr.h
$(CC) $(CFLAGS) -o $@ -c $<

mattran.o: mattran.c ../include/matrix.h
$(CC) $(CFLAGS) -o $@ -c $<

matsolve.o: matsolve.c ../include/matrix.h
$(CC) $(CFLAGS) -o $@ -c $<

open_seq_file.o: open_seq_file.c ../include/seq_io.h
$(CC) $(CFLAGS) -o $@ -c $<

close_seq_file.o: close_seq_file.c ../include/seq_io.h
$(CC) $(CFLAGS) -o $@ -c $<

main.o: main.c ../include/file_io.h ../include/nmsimplex.h ../include/corr.h ../include/seq_io.h
$(CC) $(CFLAGS) -o $@ -fopenmp -c $<

$(DESTDIR)/main: $(OBJS)
$(CC) -o $@ -fopenmp $^ $(LDFLAGS)

.PHONY: clean

clean:
rm -f *.o *~

这编译得很好。但是当我添加时:

write_time.o: write_time.c ../include/seq_io.h
$(CC) $(CFLAGS) -o $@ -c $<

我得到错误:

make: *** No rule to make target `../include/seq_io.h', needed by `write_time.o'. Stop.

最佳答案

该错误可能意味着 ../include/seq_io.h 不存在。您已将其列为依赖项,make 坚持认为依赖项存在或有某种方法可以自动创建它们。

关于c - makefile 编译目标文件没有规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18023554/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com