wspiapi.h: reference to a zero-sized array is illegal


I have a problem compiling a program in VC++ 6.0

I have downloaded this Netstatp source code from to study how to map port number to process whose it belongs.

However, I had a problem with "iphlpapi.h".
After I searched through google and experts-exchange, the solution is that I had to install MS Platform SDK which I did.

After installation, I went to VC++ Options setting in the menu Tools and move "include", "lib" and "src" dirs of the installed SDK into the top of the dir list.
(So VC++ will search for the files from SDK first.)

After I did that, I can compile the Netstatp code which I have downloaded, but when I tried to compile my OLD code, it doesnt work.
My old code uses pcap to monitor the traffic on the local machine.
(And I which to map the packets captured to their owners based on port numbers.)

The problem is, when I compile, I got this error message:

c:\program files\microsoft platform sdk\include\wspiapi.h(45) : error C2265: '<Unknown>' : reference to a zero-sized array is illegal
c:\program files\microsoft platform sdk\include\wspiapi.h(45) : error C2265: '<Unknown>' : reference to a zero-sized array is illegal

And they always occurred twice as shown.

I suspect that new version of wspiapi.h might not compatible with my environment somehow but I do not know how to fix.

Anyone has suggestions on this?
Thanks in advance!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Richard QuadlingSenior Software DeveloperCommented:
Hi bigga,

What is on line 45 of the include file?


Richard Quadling.
I did a search on google (wspiapi.h "reference to a zero-sized array is illegal") and came up with this information:

There is a problem with IPv6 with Win2K, You have to use the IPv6 preview with MSVC6 on Win2K.

Your build should detect the preview install and not the SDK. If you have problems, copy the include files from the preview to the include directory of MSVC6.

Good Luck,
biggaAuthor Commented:
Thanks for fast answer, Steve.
I went to both sites but they just tell me to install the SDK update which I already did.
It still doesnt work.

Anyway, here is the wspiapi code:

45: char (&__wspiapi_countof_helper(__CountofType (&_Array)[_N]))[_N];
46: #define _WSPIAPI_COUNTOF(_Array) sizeof(__wspiapi_countof_helper(_Array))

I also include line 46 in case it is related.
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

Richard QuadlingSenior Software DeveloperCommented:
biggaAuthor Commented:
Quite different.

However, I think I find a solution in a German website.

What I did is adding /D "_WSPIAPI_COUNTOF" to Project Options found in C/C++ tab in Project Settings.
I dont really know why but it works now.
>>I dont really know why but it works now.

Because adding /D "_WSPIAPI_COUNTOF" to Project Options causes the symbol _WSPIAPI_COUNTOF to be already defined. I am pretty sure there's a


somwhere before line 46.
Closed, 125 points refunded.

Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.