Newbie VC++ 6.0 issues

W

w0rd

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.
 
J

Jim Langston

w0rd said:
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]
 
J

Jim Langston

Jim said:
w0rd said:
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++.
 
W

w0rd

w0rd said:
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]

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
 
J

Jim Langston

w0rd said:
w0rd said:
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]

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.
 
L

lbonafide

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

Erik Wikström

Jim said:
w0rd said:
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.
 
J

Jayapal Chandran

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,809
Latest member
moe77

Latest Threads

Top