\sdk\include\wspiapi.h(47) : error C2265: '<Unknown>' : reference to a zero-sized array is illegal 解

来源:互联网 发布:打新基金 知乎 编辑:程序博客网 时间:2024/06/08 01:49

\sdk\include\wspiapi.h(47) : error C2265: '<Unknown>' : reference to a zero-sized array is illegal 解决方案

     今天,编译了Gh0st源码发现个错误,原来是我VC6有问题哟,呵呵

百度、csdn都去了,终于解决了!不敢独享,特来分享..

编写IP多播程序时,要用到ip_mrep结构,在编译时会遇到如下的错误:

 \sdk\include\wspiapi.h(47) : error C2265: '<Unknown>' : reference to a zero-sized array is illegal

 这种错误是由于wspiapi.h头文件里缺少   #define _WSPIAPI_COUNTOF 语句造成的!

 解决办法是:找到你安装的platformsdk/include目录下的wspiapi.h头文件,开头部分写如这条语句即可:#define _WSPIAPI_COUNTOF

 源代码如:
-->原库文件代码:

复制代码
1 #ifndef _WSPIAPI_H_2 #define _WSPIAPI_H_3 4 #include <stdio.h>              // sprintf()5 #include <stdlib.h>             // calloc(), strtoul()6 #include <malloc.h>             // calloc()7 #include <string.h>             // strlen(), strcmp(), strstr()
复制代码

 经过修改后代码:

复制代码
#ifndef _WSPIAPI_H_#define _WSPIAPI_H_// 添加了#define _WSPIAPI_COUNTOF#define _WSPIAPI_COUNTOF#include <stdio.h>              // sprintf()#include <stdlib.h>             // calloc(), strtoul()#include <malloc.h>             // calloc()#include <string.h>             // strlen(), strcmp(), strstr()
复制代码

     然后重新编译程序即可!

转载请注明出处! Hoiker's BLOG(雪枫香雪亭):http://hoiker.cnblogs.com/ 祝大家工作愉快!呵呵

0 0