MDK5無法編譯漢子編碼問題
MDK5.17編譯EMWIN 提示錯誤,具體現象是在包含漢子顯示的部分會出現這個BUG.
類似這種語句
{ BUTTON_CreateIndirect, "安安安", GUI_ID_BUTTON0, 350,20,420,150,0,0},
{ TEXT_CreateIndirect, "安安安安安", GUI_ID_TEXT0, 5, 10, 300, 33, 0,0},
{ TEXT_CreateIndirect, "安安安安子", GUI_ID_TEXT1, 5, 40,250, 50, 0,0},
但是原來mdk4.74的工程都無法完成編譯,提示很多錯誤。都是有中文字符的地方。另一個論壇上也提到了這個問題,而且貌似無解。
解決方案:用notepad++把文件編碼轉換為UTF-8編碼模式。之前打開顯示的編碼模式是UTF-8無BOM格式,那種格式在MDK5里面是無法正常解析的,MDK4確可以正確識別,大家在用MDK5.1遇到這個錯誤之后按照這個方法解決即可,具體原理不詳。
編譯器提示的錯誤匯總:
applications\MainTask.c(45): error: #8: missing closing quote
applications\MainTask.c(45): error: #8:missing closing quote
{BUTTON_CreateIndirect, "瀹?瀹?瀹?", GUI_ID_BUTTON0, 350,20,420,150,0,0},
applications\MainTask.c(46): error: #253:expected a ","
{TEXT_CreateIndirect, "瀹?瀹?瀹?瀹?瀹?", GUI_ID_TEXT0, 5, 10, 300, 33, 0,0},
applications\MainTask.c(46): error: #8:missing closing quote
{TEXT_CreateIndirect, "瀹?瀹?瀹?瀹?瀹?", GUI_ID_TEXT0, 5, 10, 300, 33, 0,0},
applications\MainTask.c(47): error: #8:missing closing quote
{TEXT_CreateIndirect, "瀹?瀹?瀹?瀹?瀛?", GUI_ID_TEXT1, 5, 40,250, 50, 0,0},
applications\MainTask.c(48): error: #8:missing closing quote
{TEXT_CreateIndirect, "瀹?瀹?瀹?", GUI_ID_TEXT2, 5, 100,360, 90, 0,0},
applications\MainTask.c(49): error: #8:missing closing quote
{TEXT_CreateIndirect, "瀵?", GUI_ID_TEXT3, 5, 220,144, 144, 0,0},
applications\MainTask.c(50): error: #8:missing closing quote
{TEXT_CreateIndirect, "瀵?", GUI_ID_TEXT4, 205, 230,144, 144, 0,0},
error: #8: missing closing quote
{TEXT_CreateIndirect, "瀵?", GUI_ID_TEXT5, 405, 230,144, 144, 0,0},
error: #8: missing closing quote
error: #67: expected a "}"
error: #67: expected a "}"
error: #757: function "WM_GetDialogItem" isnot a type name
error: #18: expected a ")"
error: #79: expected a type specifier
error: #147: declaration is incompatible with"void TEXT_SetFont(TEXT_Handle, const GUI_FONT *)" (declared atline 144 of "STemWin\inc\TEXT.h")
error: #40: expected an identifier
error: #757: function "WM_GetDialogItem" isnot a type name
error: #18: expected a ")"
error: #79: expected a type specifier
error: #147: declaration is incompatible with"void TEXT_SetTextColor(TEXT_Handle, GUI_COLOR)" (declared at line147 of "STemWin\inc\TEXT.h")
error: #40: expected an identifier
error: #757: function "WM_GetDialogItem" isnot a type name
error: #18: expected a ")"
error: #79: expected a type specifier
error: #40: expected an identifier
error: #757: function "WM_GetDialogItem" isnot a type name
error: #18: expected a ")"
error: #79: expected a type specifier
|