原帖由 martin4096 于 2007-12-10 11:09 发表
你定义的变量XImage *replay_ximg[MAX];这样replay_ximg就是一个两重指针,如果你只是需要MAX_SIZE的XImage,那就定义一重指针就够了,如果非用两重指针,那就对replay_ximg[0]...replay_ximg[19]每一个都分配地址。
原帖由 Atlantiscw 于 2007-12-10 12:14 发表
你只是要分配空间 ?
只需要这样:
XImage *replay_ximg;
replay_ximg = (XImage *)calloc(MAX, sizeof(XImage));
GCC 对类型检查很严格
原帖由 fanzhijie875151 于 2007-12-10 12:37 发表
conflicting type for 'replay_ximg'
previous declaration of 'replay_ximg'
initializer element is not constant
还是报错哦.....
原帖由 fanzhijie875151 于 2007-12-10 13:25 发表
我把这段程序单独拿出来写成XImage **replay_ximg;
replay_ximg = (XImage**)malloc(10 * sizeof(XImage*));
也可以通过....
但同样和我其他的源代码放到一起就出现了上面的问题.....很是奇怪
欢迎光临 Chinaunix (http://bbs.chinaunix.net/) | Powered by Discuz! X3.2 |