#! bin/bash
CC=gcc
CFLAGS=-I.
DEPS=p.h
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
hello:p1.o p2.o
gcc hello p1.o p2.o -I.
make文件制作期间显示的错误如下所示
gcc hello p1.o p2.o -I.
gcc: error: hello: No such file or directory
make: *** [hello] Error 1
执行makefile后不会创建可执行文件,但会创建obnject文件
答案 0 :(得分:2)
将gcc hello p1.o p2.o -I.
更改为gcc p1.o p2.o -o hello
答案 1 :(得分:1)
如果您的输出为hello
,请更改为
hello:p1.o p2.o
gcc p1.o p2.o -I. -o $@