標籤:eclipse eclipse makefile no rule to make targ make no target all
若要轉載請註明來源
首先看提示資訊 產生的背景make: *** No rule to make target `all‘. Stop
- 在eclipse上建立一個c project(注意:Project type: Makefile Project下的Empty Project)
- 添加c語言檔案
- 編輯自己的makefile
- 點擊project->clean 清除編譯產生的檔案
- 點擊project->build project 就會出現這個錯誤
原因
首先從提示總可知道 Current Project沒有辦法make taget ‘all’,那麼很可能就是Current Project 的編譯設定不對導致的。
其次,在IDE上找到配置Current Project Build的地方,在Project->Properties->C/C++ Build。
最後,在C/C++ Build中的Behavior Tab(行為or規則)標籤下,看到一個Build(Incremental build)CheckBox和一個文字框(內容是all),試著去掉all在編譯則會通過
或者在Build(Incremental build)後面的variable..按鈕Button中選擇build_project 或者 build_files都可編譯通過。
解決
在C/C++ Build中的Behavior Tab(行為or規則)標籤下,看到一個Build(Incremental build)CheckBox和一個文字框(內容是all)
解決方案1: 去掉all在編譯則會通過
解決方案2: 在Build(Incremental build)後面的variable..按鈕Button中選擇build_project 或者 build_files都可編譯通過。
解決方案3:在Build(Incremental build)後面的text(文字框中)輸入 -f Makefile,可以編譯通過。
總結
Build(Incremental build)意為增加編譯規則(通俗易懂點就是給make增加後面的參數),預設是all,因為makefile中all標籤不存在,所以會出現make: *** No rule to make target `all‘. Stop.
因此去掉all,實質make
添加-f Makefile ,實質是make -f Makefile
在variable..按鈕按鈕Button中選擇build_project 或者 build_files,實質是make -f Makefile
eclipse c/c++IDE 編譯 make: *** No rule to make target `all'. Stop. 解決辦法