3 回答

TA貢獻(xiàn)1817條經(jīng)驗(yàn) 獲得超14個(gè)贊
makefile與制表符有非常愚蠢的關(guān)系,每個(gè)規(guī)則的所有操作都由制表符標(biāo)識......而No 4空格不制作制表符,只有制表符制作標(biāo)簽...
檢查我使用命令 cat -e -t -v makefile_name
它顯示了選項(xiàng)卡的存在^I和行結(jié)尾$兩者對于確保依賴關(guān)系正確結(jié)束以及制表符標(biāo)記規(guī)則的操作至關(guān)重要,這樣它們很容易被make實(shí)用程序識別.....
例:
Kaizen ~/so_test $ cat -e -t -v mk.t
all:ll$ ## here the $ is end of line ...
$
ll:ll.c $
^Igcc -c -Wall -Werror -02 c.c ll.c -o ll $@ $<$
## the ^I above means a tab was there before the action part, so this line is ok .
$
clean :$
\rm -fr ll$
## see here there is no ^I which means , tab is not present ....
## in this case you need to open the file again and edit/ensure a tab
## starts the action part
希望這可以幫助 !!

TA貢獻(xiàn)1842條經(jīng)驗(yàn) 獲得超13個(gè)贊
在VS Code上,只需單擊右下角的“Space:4”,然后在編輯Makefile時(shí)將其更改為tab。
- 3 回答
- 0 關(guān)注
- 2853 瀏覽
添加回答
舉報(bào)