PIC18單片機MPLAB編譯出錯的一些問題的解決方法
Couldn't locate build tool. ?Check tool locations.
Unknowm processor:'18FXXXXX’
Halting build on first failure as requested.?Error [1027] unable to locate 'stddef.h'
Error - could not find file 'c018i.o'.
目錄
前言
一、Couldn't locate build tool. ?Check tool locations.
二、Unknowm processor:'18FXXXXX’
三、Halting build on first failure as requested.?Error [1027] unable to locate 'stddef.h'
四、Error - could not find file 'c018i.o'.
總結
前言
? ? ? ? 本文記錄了在第一次使用MPLAB來編譯程序遇到的許多報錯及解決辦法。需要給一塊單片機下個程序,第一次使用MPLAB,解決這些問題花了五六個小時,在此記錄一下,可以幫助到更多的人。
以下是本篇文章的正文內容。創作不易,若您覺得有幫助,希望您能給博主打賞。這將是對我持續創作的莫大鼓勵,萬分感謝!
一、Couldn't locate build tool. ?Check tool locations.
? ? ? ? 第一個問題:"Couldn't locate build tool. ?Check tool locations."?
報錯說找不到編譯工具,檢查工具的位置。這是因為工程的源文件是C,MPLAB只能搞定匯編語言的編譯,我們需要在電腦里面裝C語言的編譯器,可以使用官方的mcc18。然后在project→select language toolsuite選擇要用到的,如下圖所示。
然后設置編譯工具的路徑,如下圖所示。
第一個:
第二個:
設置好之后重新 Bulid all 在彈出的窗口選擇畫紅框的即可解決找不到編譯工具這個錯誤。
二、Unknowm processor:'18FXXXXX’
? ? ? ? 第二個問題,未知的器件。
報錯出現這種問題,就是因為當前安裝的mcc18版本不支持相應的器件,需要重新安裝支持相應器件的mcc18編譯器。
三、Halting build on first failure as requested.?Error [1027] unable to locate 'stddef.h'
? ? ? ? 第三個問題:
Error [1027] unable to locate 'stddef.h'
Error [1027] unable to locate 'p18cxxx.h'
Error [1027] unable to locate 'stdio.h'
Error [1027] unable to locate 'stdlib.h'
Error [1027] unable to locate 'string.h'
Error [1027] unable to locate 'limits.h'
Halting build on first failure as requested.
????????出現這些錯誤就是軟件在編譯的時候找不到頭文件,我們需要設置include 的頭文件,跟使用keil是類似的。
????????在project→Bulid Options→Project添加頭文件的路徑。
按照下圖進行設置,設置好后重新編譯就不會報找不到頭文件的錯誤了,如果你的工程還有別的頭文件路徑,需要都 include 進來。
四、Error - could not find file 'c018i.o'.
????????? 第四個問題:Error - could not find file 'c018i.o'.
這是找不到庫文件,需要像第三個一樣添加庫文件的路徑,如下圖所示。
????????設置好后重新編譯,提示編譯成功,到這里,終于編譯成功了,需要給一塊單片機下個程序,第一次使用MPLAB,解決這些問題花了五六個小時,在此記錄一下,可以幫助到更多的人。
? ? ? ? 如果有解決你的問題,可以打賞支持一下噢!
總結
???????以上就是今天要講的內容,本文記錄了在第一次使用MPLAB來編譯程序遇到的許多報錯及解決辦法。需要給一塊單片機下個程序,第一次使用MPLAB,解決這些問題花了五六個小時,在此記錄一下,可以幫助到更多的人。