1. 程式人生 > >linux下使用make指令生成程式時提示“XXX is up to date”問題的解決辦法

linux下使用make指令生成程式時提示“XXX is up to date”問題的解決辦法

2018-02-22  建立人:Ruo_Xiao
開發環境:Ubuntu 17.10
郵箱:xclsoftware@163.com
  1. 原因是makefile中要生成的檔案已存在目錄中。
  2. 解決方案:
    (1)刪除makefile中已存在的檔案。
    (2)在makefile檔案裡面加入“.PHONY:hello hello.o”。
    上述中hello代表著linux下可執行檔案,hello.o代表著目標檔案。
  3. 原始碼
.PHONY:hello hello.o
hello : hello.o
    cc -o hello hello.o
hello.o : hello.c
    cc -c hello.c
clean : rm hello.o