关于网友提出的“ illegal use of this type as an expression”问题疑问,本网通过在网上对“ illegal use of this type as an expression”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题: illegal use of this type as an expression
描述: 我定义了一个结构体
typedef struct
{
int x;
int y;
U16 itemImageId;
U16 checkId;
U16 checkedId;
int index;
char str[50];
}MY_MenuDC;
然后使用他
MY_MenuDC *MenuDC = (MY_MenuDC*)malloc(sizeof(MY_MenuDC));
结果编译报错
E:\prj_mt6235\plutommi\mmi\myapp\myappsrc\myappsrc.c(140) : error C2275: 'MY_MenuDC' : illegal use of this type as an expression
E:\prj_mt6235\plutommi\mmi\myapp\myappsrc\myappsrc.c(113) : see declaration of 'MY_MenuDC'
E:\prj_mt6235\plutommi\mmi\myapp\myappsrc\myappsrc.c(140) : error C2065: 'MenuDC' : undeclared identifier
解决方案1:#include
#include
#define U16 unsigned short
void main()
{
typedef struct
{
int x;
int y;
U16 itemImageId;
U16 checkId;
U16 checkedId;
int index;
char str[50];
}MY_MenuDC;
//然后使用他
MY_MenuDC *MenuDC = (MY_MenuDC*)malloc(sizeof(MY_MenuDC));
}
VS2005上编译通过。。。
以上介绍了“ illegal use of this type as an expression”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/3785066.html