none
Platform SDK & MS Visual C++ 6.0 compile errors

    Question

  • Hi,

    I'm running WinXP home O/S and developing an application using Visual C++ 6.0 (Enterprise Edition, SP6). I want to use Windows Sockets 2.

    My resources recommend using the getaddrinfo() function but, having included the relevant Winsock header/s & linking to the appropriate DLLs (see code below) I was getting compile errors indicating that addrinfo struct was unknown.

    After some cursory web research I came to the conclusion that my development system was out-of-date, so I have downloaded & installed the latest SDK I could find, i.e.

    Microsoft® Windows® Platform SDK Collection for Windows Server 2003 SP1
    Copyright 2004 Microsoft Corporation

    I believe I have modified my project settings to meet the requirements documented in the SDK for using Winsock 2:

    <from SDK docs>

    To create a basic Winsock application

    1. Create a new empty project.
    2. Add an empty C++ source file to the project.
    3. Ensure that the build environment refers to the Include, Lib, and Src directories of the Microsoft Platform SDK.
    4. Ensure that the build environment links to the Winsock Library file WS2_32.lib.
    5. Begin programming the Winsock application. Use the Winsock API by including the Winsock 2 header file.

    </from SDK docs>

    However, when I now attempt to compile, the following errors are generated:

    <errors>

    d:\program files\microsoft platform sdk\include\wspiapi.h(45) : error C2265: '<Unknown>' : reference to a zero-sized array is illegal
    d:\program files\microsoft platform sdk\include\wspiapi.h(45) : error C2265: '<Unknown>' : reference to a zero-sized array is illegal
    d:\program files\microsoft platform sdk\include\wspiapi.h(57) : error C2143: syntax error : missing ')' before '*'
    d:\program files\microsoft platform sdk\include\wspiapi.h(57) : error C2143: syntax error : missing ';' before '*'
    d:\program files\microsoft platform sdk\include\wspiapi.h(57) : error C2059: syntax error : ')'
    d:\program files\microsoft platform sdk\include\wspiapi.h(58) : error C2061: syntax error : identifier 'IN'
    d:\program files\microsoft platform sdk\include\wspiapi.h(61) : error C2501: 'WSPIAPI_PGETADDRINFO' : missing storage-class or type specifiers
    d:\program files\microsoft platform sdk\include\wspiapi.h(63) : error C2226: syntax error : unexpected type 'WINAPI'
    d:\program files\microsoft platform sdk\include\wspiapi.h(72) : error C2226: syntax error : unexpected type 'WINAPI'
    d:\program files\microsoft platform sdk\include\wspiapi.h(89) : error C2146: syntax error : missing ';' before identifier 'WspiapiStrdup'
    d:\program files\microsoft platform sdk\include\wspiapi.h(89) : error C2433: 'WINAPI' : 'inline' not permitted on data declarations
    d:\program files\microsoft platform sdk\include\wspiapi.h(89) : error C2377: 'WINAPI' : redefinition; typedef cannot be overloaded with any other symbol
            d:\program files\microsoft platform sdk\include\wspiapi.h(57) : see declaration of 'WINAPI'
    d:\program files\microsoft platform sdk\include\wspiapi.h(89) : fatal error C1004: unexpected end of file found
    Error executing cl.exe.

    </errors>

    Are there known issues compiling wspiapi.h (or other SDK stuff) using VC++ 6.0 SP6? Should I be using a later technology to develop against this SDK? I understand that there are also older, legacy Winsock functions but I'd rather not use them.

    Any advice would be appreciated.

    n.b. My class header includes & project options settings:

    <header>

    #include <stdio.h>
    #include <string>
    #include <vector>
    #include <WSPIAPI.H>
    #include <WS2TCPIP.H>
    #include <WINSOCK2.H> // Winsock v2
    #pragma warning(disable: 4786)

    <header>

    <Settings>

    /nologo /MLd /W3 /Gm /GX /ZI /Od /I "D:\program files\microsoft platform sdk\include" /I "D:\program files\microsoft platform sdk\src" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR"Debug/" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c

    Cheers

    Robert

     

     

     

     

     

     

     

    Saturday, February 11, 2006 5:54 PM

Answers

  • Is there any way you step up to VS 2003 (VC7) or VS 2005 (VC8)?  This smells like an incompatibility between VC6 and the Windows Platform SDK, which was published in 2003.

     

    Saturday, February 11, 2006 6:49 PM
    Moderator

All replies