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

Hi,

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

I have downloaded this Netstatp source code from http://www.sysinternals.com/Utilities/TcpView.html 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!
LVL 1
biggaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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?

Regards,

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

http://www.openh323.org/pipermail/openh323/2005-June/074119.html

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

http://www.voxgratia.org/docs/windows_ipv6.html

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,
Steve
0
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.
0
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Richard QuadlingSenior Software DeveloperCommented:
0
biggaAuthor Commented:
Quite different.

However, I think I find a solution in a German website.
http://www.c-plusplus.de/forum/viewtopic-var-t-is-112743-and-start-is-10-and-postdays-is-0-and-postorder-is-asc-and-highlight-is-.html-and-printview-is-1-and-start-is-0.html

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.
0
jkrCommented:
>>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

#ifndef _WSPIAPI_COUNTOF

somwhere before line 46.
0
moduloCommented:
Closed, 125 points refunded.

modulo
Community Support Moderator
0

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.