\sdk\include\wspiapi.h(47) : error C2265: '' : 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/ 祝大家工作愉快!呵呵

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章