我正在嘗試為我的代碼構建一個 Makefile 并且由于某種原因我得到了
./ex2_q1 11 24 36 7 5
有3個素數
make: *** [Makefile:11: test] 錯誤 3
第二行是程式的輸出。一切似乎都正常,但我不知道為什么會出現錯誤。
生成檔案是:
PROG = ex2_q1
all: test
test: ex2_q1
./ex2_q1 11 24 36 7 5
factors.o: factors.c
gcc -Wall -c factors.c
ex2_q1.o: ex2_q1.c
gcc -Wall -c ex2_q1.c
clean:
rm -vf *.o $(PROG)
rm -vf *.o factors
rm -vf *.txt
rm -vf *.log
factors: factors.o
gcc -o factors -Wall factors.o
ex2_q1: ex2_q1.o factors
gcc -o ex2_q1 -Wall ex2_q1.o
uj5u.com熱心網友回復:
您的程式,ex2_q1呼叫 as./ex2_q1 11 24 36 7 5回傳非零結果。這表示錯誤以及解決該錯誤的正確方法是修復您的程式。如果您無法修復程式,您可以通過將配方更改為 來消除錯誤./ex2_q1 11 24 36 7 5 || true。如果您仍然想要錯誤訊息但繼續構建,您可以使用-k標志運行 make ,或者您可以在配方前添加一個-:
test: ex2_q1
- ./ex2_q1 11 24 36 7 5
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/367263.html
下一篇:內核終端中的游標
