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

来源:互联网 发布:php三级分销代码 编辑:程序博客网 时间:2024/05/18 01:26
        今天,编译了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

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

#ifndef _WSPIAPI_H_#define _WSPIAPI_H_#include <stdio.h>              // sprintf()#include <stdlib.h>             // calloc(), strtoul()#include <malloc.h>             // calloc()#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://blog.csdn.net/XenoStudio 祝大家工作愉快!呵呵

原创粉丝点击