21ic问答首页 - XC32对于const数组编译问题
XC32对于const数组编译问题
PIC32MZ2021-03-05
typedef struct
{
unsigned char Ind[2];
char Mss[32];
}typFNT_GB16;
const typFNT_GB16 tfont16[]={
"深",0x00,0x00,0x27,0xFC,0x14,0x04,0x14,0xA4,0x81,0x10,0x42,0x08,0x40,0x40,0x10,0x40,
0x17,0xFC,0x20,0x40,0xE0,0xE0,0x21,0x50,0x22,0x48,0x2C,0x46,0x20,0x40,0x00,0x40,/*0*/
};
上面这个数组,XC16编译器可以编译通过。没有问题。
XC32编译器编译不能通过。
开发环境 MPLAB X IDE 5.45.
XC32: 2.50
使用harmony3.
XC32提示如下:
In file included from ../src/myCode/lcd/gui.c:4:0:
../src/myCode/lcd/font.h:217:5: error: missing braces around initializer [-Werror=missing-braces]
{"??",0x00,0x00,0x27,0xFC,0x14,0x04,0x14,0xA4,0x81,0x10,0x42,0x08,0x40,0x40,0x10,0x40,
nbproject/Makefile-default.mk:370: recipe for target 'build/default/production/_ext/1784247729/gui.o' failed
^
make[2]: Leaving directory 'D:/1111/FWS/KEY5/KEY5_LCD/V6_PIC32MZ/CODE/PIC32_H/firmware/PIC32MZ.X'
../src/myCode/lcd/font.h:217:5: error: (near initialization for 'tfont16[0].Msk') [-Werror=missing-braces]
cc1.exe: all warnings being treated as errors
nbproject/Makefile-default.mk:91: recipe for target '.build-conf' failed
make[2]: *** [build/default/production/_ext/1784247729/gui.o] Error 255
make[1]: Leaving directory 'D:/1111/FWS/KEY5/KEY5_LCD/V6_PIC32MZ/CODE/PIC32_H/firmware/PIC32MZ.X'
make[1]: *** [.build-conf] Error 2
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 6s)
百度了一下,error: missing braces around initializer
加了大括号。
const typFNT_GB16 tfont16[]={
{"深",0x00,0x00,0x27,0xFC,0x14,0x04,0x14,0xA4,0x81,0x10,0x42,0x08,0x40,0x40,0x10,0x40,
0x17,0xFC,0x20,0x40,0xE0,0xE0,0x21,0x50,0x22,0x48,0x2C,0x46,0x20,0x40,0x00,0x40,/*0*/
}
};
还是不行,编译不通过。
哪位大神可以指导一下,这是什么原因啊?
{
unsigned char Ind[2];
char Mss[32];
}typFNT_GB16;
const typFNT_GB16 tfont16[]={
"深",0x00,0x00,0x27,0xFC,0x14,0x04,0x14,0xA4,0x81,0x10,0x42,0x08,0x40,0x40,0x10,0x40,
0x17,0xFC,0x20,0x40,0xE0,0xE0,0x21,0x50,0x22,0x48,0x2C,0x46,0x20,0x40,0x00,0x40,/*0*/
};
上面这个数组,XC16编译器可以编译通过。没有问题。
XC32编译器编译不能通过。
开发环境 MPLAB X IDE 5.45.
XC32: 2.50
使用harmony3.
XC32提示如下:
In file included from ../src/myCode/lcd/gui.c:4:0:
../src/myCode/lcd/font.h:217:5: error: missing braces around initializer [-Werror=missing-braces]
{"??",0x00,0x00,0x27,0xFC,0x14,0x04,0x14,0xA4,0x81,0x10,0x42,0x08,0x40,0x40,0x10,0x40,
nbproject/Makefile-default.mk:370: recipe for target 'build/default/production/_ext/1784247729/gui.o' failed
^
make[2]: Leaving directory 'D:/1111/FWS/KEY5/KEY5_LCD/V6_PIC32MZ/CODE/PIC32_H/firmware/PIC32MZ.X'
../src/myCode/lcd/font.h:217:5: error: (near initialization for 'tfont16[0].Msk') [-Werror=missing-braces]
cc1.exe: all warnings being treated as errors
nbproject/Makefile-default.mk:91: recipe for target '.build-conf' failed
make[2]: *** [build/default/production/_ext/1784247729/gui.o] Error 255
make[1]: Leaving directory 'D:/1111/FWS/KEY5/KEY5_LCD/V6_PIC32MZ/CODE/PIC32_H/firmware/PIC32MZ.X'
make[1]: *** [.build-conf] Error 2
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 6s)
百度了一下,error: missing braces around initializer
加了大括号。
const typFNT_GB16 tfont16[]={
{"深",0x00,0x00,0x27,0xFC,0x14,0x04,0x14,0xA4,0x81,0x10,0x42,0x08,0x40,0x40,0x10,0x40,
0x17,0xFC,0x20,0x40,0xE0,0xE0,0x21,0x50,0x22,0x48,0x2C,0x46,0x20,0x40,0x00,0x40,/*0*/
}
};
还是不行,编译不通过。
哪位大神可以指导一下,这是什么原因啊?
赞0
评论
2021-03-05
您需要登录后才可以回复 登录 | 注册