[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: gethostbyname2 / getipnodebyname



On Sat, Apr 27, 2002 at 05:38:21PM +0100, Jason Williams wrote:
| I'm using Debian woody (last updated probly a month or so ago). I'm trying
| to use gethostbyname2 or getipnodebyname, but despite the fact that they
| are mentioned in the man pages and the netdb.h header file, which I am
| including, g++ is claiming they are undeclared. Neither does it work
| if I explicitly include an appropriate extern declaration in my source.
| 
| Any ideas? Am I just being stupid?
| 
| 
| $ cat test.cpp
| #include <sys/types.h>
| #include <sys/socket.h>
| #include <netdb.h>
| 
| 
| int main(void)
| {
|   struct hostent *foo;
| 
|   foo = gethostbyname2("localhost-ip6",AF_INET6);
| }
| 
| $ g++ -Wall -ansi -pedantic test.cpp
| test.cpp: In function `int main()':
| test.cpp:9: `gethostbyname2' undeclared (first use this function)
| test.cpp:9: (Each undeclared identifier is reported only once
| test.cpp:9: for each function it appears in.)
| $

grep tells me that function is declared in /usr/include/netdb.h.  With
g++ 2.95 I get the same error, but g++ 3.0 works fine.  I get the same
set of results with gcc.

HTH,
-D

-- 

The lot is cast into the lap,
but its every decision is from the Lord.
        Proverbs 16:33
 
GnuPG key : http://dman.ddts.net/~dman/public_key.gpg

Attachment: pgp1pnwUlGeJ0.pgp
Description: PGP signature


Reply to: