今天,编译了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/ 祝大家工作愉快!呵呵

posted on 2011-02-22 18:04  雪枫香雪亭  阅读(7342)  评论(1编辑  收藏  举报