![](/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.