bigga
asked on
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!
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!
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
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
ASKER
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 (__Countof Type (&_Array)[_N]))[_N];
46: #define _WSPIAPI_COUNTOF(_Array) sizeof(__wspiapi_countof_h elper(_Arr ay))
I also include line 46 in case it is related.
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
46: #define _WSPIAPI_COUNTOF(_Array) sizeof(__wspiapi_countof_h
I also include line 46 in case it is related.
ASKER
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.
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.
>>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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What is on line 45 of the include file?
Regards,
Richard Quadling.