Re: [vim ] 有沒有得到"文件名"的函式

看板Editor作者 (About)時間13年前 (2010/11/04 17:45), 編輯推噓2(200)
留言2則, 2人參與, 最新討論串3/3 (看更多)
在 vim 裡面打 :make 預設就是系統執行 make 如果資料夾下沒有 makefile 的話將會套用 implicit rules 所有 GNU make 的 implicit rules 可以參考 http://0rz.tw/Y9euv 其中跟你想做有關的應該是以下兩條 1. %.o: %.cpp # 把 C++ 的檔案變成 object file 2. %: %.o # 把 object file 變成 binary file 如果打 :make temp.cpp (等同於 :make %) 實際上並沒有相關的 implicit rule 所以 GNU make 會說 `temp.cpp' is up to date. 真正需要 compiler 重編的情況應該是要做成 object file 或是 binary file 的時候 所以可以試試看 :make temp.o 或是 :make temp 若講詳細一點可以想像 GNU make 有以下的規則 temp: temp.cpp g++ temp.cpp -o temp 所以下 :make temp.cpp 是不會重編的 不知道有沒有解答你的問題 有誤請提出 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.24.2.70

11/05 14:23, , 1F
喔喔! make %:r 就能順利編譯了!謝謝~~
11/05 14:23, 1F

11/07 21:56, , 2F
抱歉, 沒講清楚 XD
11/07 21:56, 2F
文章代碼(AID): #1Cqe3BP_ (Editor)
文章代碼(AID): #1Cqe3BP_ (Editor)