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
|