Newbie VC++ 6.0 issues

Discussion in 'C++' started by w0rd, Apr 1, 2008.

  1. w0rd

    w0rd Guest

    Hi guys,
    Wondering if you could help me with some errors I've been getting with
    the source of a commissioned project. I've got no C++ experience so
    I've got no idea what's going on but when I try to compile in debug
    mode I get these errors (I've included the lines lines where the
    errors happen if it helps):

    addrinfo *AI;
    \Async.cpp(47) : error C2065: 'addrinfo' : undeclared identifier
    \Async.cpp(47) : error C2065: 'AI' : undeclared identifier
    \Async.cpp(47) : warning C4552: '*' : operator has no effect; expected
    operator with side-effect

    if(getaddrinfo(lpszHost, "80", NULL, &AI) != 0)
    \Async.cpp(50) : error C2065: 'getaddrinfo' : undeclared identifier

    SOCKET s = socket(AI->ai_family, SOCK_STREAM, 0);
    \Async.cpp(56) : error C2227: left of '->ai_family' must point to
    class/struct/union

    if(connect(s, AI->ai_addr, AI->ai_addrlen) == SOCKET_ERROR)
    \Async.cpp(63) : error C2227: left of '->ai_addr' must point to class/
    struct/union
    \Async.cpp(63) : error C2227: left of '->ai_addrlen' must point to
    class/struct/union

    ULONG (PASCAL *SendMail)(ULONG, ULONG_PTR, MapiMessage*, FLAGS,
    ULONG);
    \Utils.cpp(257) : error C2143: syntax error : missing ')' before
    '__stdcall'
    \Utils.cpp(257) : error C2059: syntax error : ')'

    (FARPROC&)SendMail = GetProcAddress(hMAPI, _T("MAPISendMail"));
    \Utils.cpp(258) : error C2065: 'SendMail' : undeclared identifier

    int nError = SendMail(0, (ULONG_PTR)AfxGetMainWnd()->m_hWnd,
    &message, MAPI_LOGON_UI|MAPI_DIALOG, 0);
    \Utils.cpp(284) : error C2065: 'ULONG_PTR' : undeclared identifier
    \Utils.cpp(284) : error C2146: syntax error : missing ')' before
    identifier 'AfxGetMainWnd'
    \Utils.cpp(284) : error C2059: syntax error : ')'

    I've got a feeling some of the errors come from me missing some sort
    of global files.
    Thanks in advance.
     
    w0rd, Apr 1, 2008
    #1
    1. Advertising

  2. w0rd

    Jim Langston Guest

    w0rd wrote:
    > Hi guys,
    > Wondering if you could help me with some errors I've been getting with
    > the source of a commissioned project. I've got no C++ experience so
    > I've got no idea what's going on but when I try to compile in debug
    > mode I get these errors (I've included the lines lines where the
    > errors happen if it helps):
    >
    > addrinfo *AI;
    > \Async.cpp(47) : error C2065: 'addrinfo' : undeclared identifier


    These, and the following errors, seem to be occuring because you're missing
    the include of the header file where they are defined. The actual header
    file for sockets depends on your OS and compiler. In windows it might be
    #include <WinSock2.h> or #include <WinSock.h> or something else.

    On Linux I couldn't tell you, check your documentation.

    [SNIP similar type errors]

    --
    Jim Langston
     
    Jim Langston, Apr 1, 2008
    #2
    1. Advertising

  3. w0rd

    Jim Langston Guest

    Jim Langston wrote:
    > w0rd wrote:
    >> Hi guys,
    >> Wondering if you could help me with some errors I've been getting
    >> with the source of a commissioned project. I've got no C++
    >> experience so I've got no idea what's going on but when I try to
    >> compile in debug mode I get these errors (I've included the lines
    >> lines where the errors happen if it helps):
    >>
    >> addrinfo *AI;
    >> \Async.cpp(47) : error C2065: 'addrinfo' : undeclared identifier

    >
    > These, and the following errors, seem to be occuring because you're
    > missing the include of the header file where they are defined. The
    > actual header file for sockets depends on your OS and compiler. In
    > windows it might be #include <WinSock2.h> or #include <WinSock.h> or
    > something else.
    > On Linux I couldn't tell you, check your documentation.
    >
    > [SNIP similar type errors]


    My bad. Your post is titled VC++ 6.0 issues. Try
    #include <WinSock2.h>
    but you really should get away from 6.0 It was made prestandard and has
    other issues that'll frustrate you in the future to no end. You can
    download a free 2003 C++ from Microsoft although it has no optimizations of
    the executable. Or download Dev C++.

    --
    Jim Langston
     
    Jim Langston, Apr 1, 2008
    #3
  4. w0rd

    w0rd Guest

    On Apr 1, 3:05 pm, "Jim Langston" <> wrote:
    > w0rd wrote:
    > > Hi guys,
    > > Wondering if you could help me with some errors I've been getting with
    > > the source of a commissioned project. I've got no C++ experience so
    > > I've got no idea what's going on but when I try to compile in debug
    > > mode I get these errors (I've included the lines lines where the
    > > errors happen if it helps):

    >
    > > addrinfo *AI;
    > > \Async.cpp(47) : error C2065: 'addrinfo' : undeclared identifier

    >
    > These, and the following errors, seem to be occuring because you're missing
    > the include of the header file where they are defined. The actual header
    > file for sockets depends on your OS and compiler. In windows it might be
    > #include <WinSock2.h> or #include <WinSock.h> or something else.
    >
    > On Linux I couldn't tell you, check your documentation.
    >
    > [SNIP similar type errors]
    >
    > --
    > Jim Langston
    >


    Ok, I'm using Visual C++ 6.0 with SP6 but not Visual Studio. I tried
    adding those files and they're there but it doesn't have the
    "addrinfo" procedure
     
    w0rd, Apr 1, 2008
    #4
  5. w0rd

    Jim Langston Guest

    w0rd wrote:
    > On Apr 1, 3:05 pm, "Jim Langston" <> wrote:
    >> w0rd wrote:
    >>> Hi guys,
    >>> Wondering if you could help me with some errors I've been getting
    >>> with the source of a commissioned project. I've got no C++
    >>> experience so I've got no idea what's going on but when I try to
    >>> compile in debug mode I get these errors (I've included the lines
    >>> lines where the errors happen if it helps):

    >>
    >>> addrinfo *AI;
    >>> \Async.cpp(47) : error C2065: 'addrinfo' : undeclared identifier

    >>
    >> These, and the following errors, seem to be occuring because you're
    >> missing the include of the header file where they are defined. The
    >> actual header file for sockets depends on your OS and compiler. In
    >> windows it might be #include <WinSock2.h> or #include <WinSock.h> or
    >> something else.
    >>
    >> On Linux I couldn't tell you, check your documentation.
    >>
    >> [SNIP similar type errors]
    >>
    >> --
    >> Jim Langston
    >>

    >
    > Ok, I'm using Visual C++ 6.0 with SP6 but not Visual Studio. I tried
    > adding those files and they're there but it doesn't have the
    > "addrinfo" procedure


    From the MSDN that comes with my MSVC++ .net 2003 for getaddrinfo:

    Requirements
    Client: Included in Windows XP.
    Server: Included in Windows Server 2003.
    Header: Declared in Ws2tcpip.h.

    So try
    #include <Ws2tcpip.h>
    I guess.


    --
    Jim Langston
     
    Jim Langston, Apr 1, 2008
    #5
  6. w0rd

    Ian Collins Guest

    w0rd wrote:
    >
    > Ok, I'm using Visual C++ 6.0 with SP6 but not Visual Studio.


    Why? It's old and well past its best.

    --
    Ian Collins.
     
    Ian Collins, Apr 1, 2008
    #6
  7. w0rd

    Guest

    On Apr 1, 12:13 am, w0rd <> wrote:

    > Ok, I'm using Visual C++ 6.0 with SP6 but not Visual Studio.  I tried
    > adding those files and they're there but it doesn't have the
    > "addrinfo" procedure- Hide quoted text -


    Why aren't you asking in a Windows newsgroup that deals with VS
    issues?
     
    , Apr 1, 2008
    #7
  8. On 2008-04-01 07:07, Jim Langston wrote:
    > Jim Langston wrote:
    >> w0rd wrote:
    >>> Hi guys,
    >>> Wondering if you could help me with some errors I've been getting
    >>> with the source of a commissioned project. I've got no C++
    >>> experience so I've got no idea what's going on but when I try to
    >>> compile in debug mode I get these errors (I've included the lines
    >>> lines where the errors happen if it helps):
    >>>
    >>> addrinfo *AI;
    >>> \Async.cpp(47) : error C2065: 'addrinfo' : undeclared identifier

    >>
    >> These, and the following errors, seem to be occuring because you're
    >> missing the include of the header file where they are defined. The
    >> actual header file for sockets depends on your OS and compiler. In
    >> windows it might be #include <WinSock2.h> or #include <WinSock.h> or
    >> something else.
    >> On Linux I couldn't tell you, check your documentation.
    >>
    >> [SNIP similar type errors]

    >
    > My bad. Your post is titled VC++ 6.0 issues. Try
    > #include <WinSock2.h>
    > but you really should get away from 6.0 It was made prestandard and has
    > other issues that'll frustrate you in the future to no end. You can
    > download a free 2003 C++ from Microsoft although it has no optimizations of
    > the executable. Or download Dev C++.


    I assume you meant Visual C++ 2008 Express, in which case I can tell you
    that it does perform (almost) all the optimisations that the more costly
    versions do, what it lacks it the ability to use the profiler to guide
    the optimisations.

    --
    Erik Wikström
     
    Erik Wikström, Apr 1, 2008
    #8
  9. w0rd

    w0rd Guest

    On Apr 1, 3:29 pm, Ian Collins <> wrote:
    > w0rd wrote:
    >
    > > Ok, I'm using Visual C++ 6.0 with SP6 but not Visual Studio.

    >
    > Why? It's old and well past its best.
    >
    > --
    > Ian Collins.


    I know but it was programmed in VC 6.0 (by Konst from R-a-C and that's
    just what he uses).
     
    w0rd, Apr 2, 2008
    #9
  10. typedef struct addrinfo {
    int ai_flags;
    int ai_family;
    int ai_socktype;
    int ai_protocol;
    size_t ai_addrlen;
    char* ai_canonname;
    struct sockaddr* ai_addr;
    struct addrinfo* ai_next;
    } ADDRINFOA,
    *PADDRINFOA;

    i pasted theabove in the code and it worked...
    also i included this definition

    #define AI_PASSIVE 1 which you can find in the header file of
    ws2tcpip.h
     
    Jayapal Chandran, Apr 19, 2008
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MDBloemker
    Replies:
    1
    Views:
    408
    Rick Spiewak
    May 10, 2004
  2. =?Utf-8?B?Y2xzbWl0aDY2?=

    Newbie: Screen size issues

    =?Utf-8?B?Y2xzbWl0aDY2?=, Jan 4, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    378
    Weston Weems
    Jan 5, 2005
  3. Replies:
    2
    Views:
    429
    Viator
    Dec 22, 2005
  4. jelle feringa
    Replies:
    0
    Views:
    400
    jelle feringa
    Jul 27, 2004
  5. SabaUd

    Some newbie casting issues

    SabaUd, Dec 1, 2007, in forum: C Programming
    Replies:
    6
    Views:
    272
    Peter Nilsson
    Dec 2, 2007
Loading...

Share This Page