![](/img/trans.png)
[英]Why is my program not showing any output? 0 errors, 0 warnings but no output? I'm using Dev C++ compiler
[英]Why aren't compiler flags I specify in my makefile showing up in my terminal (Cygwin) output?
所以我正在尝试使用 Cygwin 终端运行 C 代码,我有一个名为 Makefile.mak 的 makefile,其中包含以下内容:
CFLAGS=-Wall -g
clean:
rm -f ex3
我的书“Learn C the Hard Way”说我需要使用命令“make clean”,但是,当我写这个时,我得到了错误
make: *** No rule to make target 'clean'. Stop.
仅当我键入时才有效
make -f Makefile.mak clean."
下一个问题是,当我在 C 文件(ex3.c)上尝试 make 命令时,我得到 output
cc ex3.c -o ex3
但是我也应该从我的 makefile 中看到 output 中的标志。 像这样:
cc -Wall -g ex3.c -o ex3.
我尝试更改 gcc 编译器中的设置,但仍然没有。
我在同一文件路径中还有 makefile 和我的 C 代码文件。
任何帮助将不胜感激。
文件名 Makefile.mak 默认不被make
拾取。 为此,您需要将其命名为“makefile”或“Makefile”。
至于编译命令,您没有指定如何构建 ex3 的目标。 您需要添加:
ex3: ex3.c
cc $(CFLAGS) -o $@ $^
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.