#!bin/bash
CC=gcc /*gcc compiler*/
CFLAGS=-I. /*current working directory*/
hello: p1.o p2.o p.h /*hello is the executable i want to create*/
$(cc) -o hello p1.o p2.o p.h -I.
显示的错误是
o hello p1.o p2.o p.h -I.
make: o: Command not found
make: [hello] Error 127 (ignored)
通过执行 make 它正在创建代码的目标文件,但未创建可执行文件 hello
最佳答案
make
的变量区分大小写。你需要写
$(CC) -o hello p1.o p2.o p.h -I.
由于未设置$(cc)
,make
将尝试执行-o hello ...
。前导破折号会抑制 make
语法中的错误,因此生成的命令就是您看到的 o hello ...
。
关于c - executable(hello) 未创建,已创建两个程序的目标文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22955283/