Makefile 的乙個常見錯誤

2022-03-06 06:33:11 字數 882 閱讀 5985

因為工作需要,經常要寫window 和 unix 系統相容的程式。

可是,我在visual studio 2005 上寫好makefile 以後,放到freebsd

上,就是編譯不了,報下面的錯誤:

make: fatal errors encountered -- cannot continue

我寫了乙個很簡單的測試make :

helloworld:main.o mylib.o

gcc main.o mylib.o -o helloworld

main.o:main.c mylib.h

gcc -c main.c -o main.o

mylib.o:mylib.c mylib.h

gcc -c mylib.c -o mylib.o

clean:

rm -rf *.o helloworld

可還是報:

"makefile", line 2: need an operator

"makefile", line 5: need an operator

"makefile", line 8: need an operator

"makefile", line 11: need an operator

make: fatal errors encountered -- cannot continue

想了半天,發現我設定了 visual studio 2005  tab as space,

也就是說,在我的visual studio 2005 上敲擊 tab 鍵,自動會轉換成space。

而上面的gcc 的前面需要乙個tab 鍵。

如果,你有和我相同的問題,就要看看是不是 在你的編輯器上設定了 tab as space。

乙個常見的錯誤

d software codeblocks test1 main.c 28 warning suggest parentheses around assignment used as truth value wparentheses warning的有道翻譯 警告 建議括號周圍的賦值作為真值 如下 ...

Makefile常見錯誤總結

makefile 經常遇到一些錯誤,有時候難以解決,作者把遇到的問題以及解決思路總結下來,以供參考。解決思路 最常見的可能是沒有正確書寫select io.o對應的原始檔的路徑。fini 0x0 multiple definition of fini usr lib gcc x86 64 linux...

針對搜尋的乙個常見錯誤

今天寫了乙個搜尋題目,看起來比較難,其實很簡單,就是普通的最短路新增了乙個分值。對於這個題目,只要在鬆弛的同時保持最大的score就可以,也是很常見的,我很容易出錯的多重if判斷。很容易少考慮。考慮目前的邊 t e 路徑權值是w maxsco為維護的最大的score,而sco i 為i的分值,只要到...