在移植工程的時候,頭檔案包含了cortex系列的頭檔案和cmsis的armcc頭檔案。
編譯過後是0錯誤0警告的,程式下載下傳運作也是沒問題的。但是keil左邊有個大叉号,提示頭檔案錯誤error in include chain(cmsis_armcc.h):expected identifier or '(' 。
經過逐層尋找發現在cmsis_armcc.h中的靜态内聯沒有定義,但是gotodefine依舊可以跳轉,于是把cm0plus.h頭檔案include一下,好了叉号沒有了。。。但是!!編譯工程全是警告---方法不可行。
參考博文 點這裡,和作者一樣我也有強迫症,使用部落客的方法成功解決,到Keil的安裝目錄下的 UV4 檔案夾,搜尋找到檔案夾中的 UVCC.ini 檔案,用記事本打開,将報錯的那個頭檔案添加到檔案中 (即添加一句 xxxx.h = *)
; specification of errors which are to be ignored for syntax highlighting
; format: ini file, section beginning with '[' is skipped
; module = * :== ignore all messages associated with this module
; module = line :== ignore all messages associated with the specified line number in this module
; e.g. abc.h = 275 ; all messages associated with line number 275 in abc.h will be ignored
core_cm0.h = *
core_cm3.h = *
core_cm4.h = *
core_cm0plus.h = *
core_cm4_simd.h = *
core_cmInstr.h = *
limits = *
math.h = *
string.h = *
wchar.h = *
STM32F10x.h = *
stdio.h = *
stdarg.h = *
system_stm32f10x.h = *
cmsis_armcc.h = *
大體的意思就是哪個頭檔案報錯,就把這個錯誤忽略掉。。(ignore) 形式就是 moudle = *或者 moudle = line_number
也就是說keil啟動的時候會讀取這個初始化檔案,把所提到的檔案全部或者其中幾行的錯誤或警告忽略掉,但是不是代表編譯不會報錯。