開發平台(Platform): (Ex: Win10, Linux, ...)
win10 + MSYS2
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
mingw
問題(Question):
我用C語言寫了一個遊戲
而我想挑戰只用編輯器和make來完成
程式編譯通過了(.o檔)
但卻在連結時出了問題
像這樣 https://i.imgur.com/lO4mEoq.jpg
程式架構大概像這樣
我在.h檔中宣告了所有函數
在a.c中使用這些函數,而這些函數則定義在b.c中
而我覺得原因可能有兩種
1.我對C語言不夠熟悉,可能需要加些關鍵字告訴編譯器要如何連結
2.我剛從Google學來寫的make有問題
我覺得2的可能性比較大
想問問看大大們有什麼看法,謝謝
餵入的資料(Input):
原始檔
預期的正確結果(Expected Output):
執行檔
程式碼(Code):(請善用置底文網頁, 記得排版,禁止使用圖檔)
補充說明(Supplement):
Makefile
CC = gcc
game: main.o snake.o draw.o scenes.o init.o linkedlist.o os_func.o sna.h
$(CC) -o game main.o snake.o draw.o scenes.o init.o linkedlist.o os_fu
nc.o
%.o: %.c sna.h
$(CC) -c $<
clean:
rm -f *.out *.exe *o