gethostbyname C2143
-
Hi all, Simple function (cut down to not include all the other crap. I have #included the winsock.h and included the wsock32.lib. int GetIPAddresses() { char shostname[255]; int e = 0; e=gethostname(shostname, sizeof(shostname)); struct hostent *pdata = ::gethostbyname(ashostname); } On compiling I get this error : error C2143: syntax error : missing ';' before 'type' Does anyone know what that is? [EDIT]This is in C and not C++. I forgot to mention that.[/EDIT] Cheers, "If you're too careful, your whole life can become a f---in' grind." - Mike McD (Rounders)
-
Hi all, Simple function (cut down to not include all the other crap. I have #included the winsock.h and included the wsock32.lib. int GetIPAddresses() { char shostname[255]; int e = 0; e=gethostname(shostname, sizeof(shostname)); struct hostent *pdata = ::gethostbyname(ashostname); } On compiling I get this error : error C2143: syntax error : missing ';' before 'type' Does anyone know what that is? [EDIT]This is in C and not C++. I forgot to mention that.[/EDIT] Cheers, "If you're too careful, your whole life can become a f---in' grind." - Mike McD (Rounders)
Have you tried using the winsock2 stuff instead?
winsock2.h
andws2.lib
Ant. I'm hard, yet soft.
I'm coloured, yet clear.
I'm fruity and sweet.
I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain) -
Have you tried using the winsock2 stuff instead?
winsock2.h
andws2.lib
Ant. I'm hard, yet soft.
I'm coloured, yet clear.
I'm fruity and sweet.
I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)Hi Ant, Yes I have, and still the same error. Cheers, "If you're too careful, your whole life can become a f---in' grind." - Mike McD (Rounders)