打印

XC32对于const数组编译问题

[复制链接]
1386|1
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
PIC32MZ|  楼主 | 2021-3-5 15:28 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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*/
        }
};

还是不行,编译不通过。
哪位大神可以指导一下,这是什么原因啊?

使用特权

评论回复
沙发
便携手到老| | 2021-3-5 18:10 | 只看该作者
你的指针有问题,检查一下指针。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

1

帖子

0

粉丝