Undefined reference to 'gethostent'
Mon May 31 21:10:00 GMT 1999
On Mon, 24 May 1999, Matthew Golzari wrote:
> During linking the next line:
> $ gcc -o test test.o
> I get the following error message:
> test.o(.text+0x387):test.c: undefined reference to 'gethostent'
> collect2: Id returned 1 exit status
That's because gethostent doesn't exist in Cygwin. Unless you really
need to enumerate *all* the hosts in the database, this routine has
no place in networking code! These are especialy bad since the usual
implementations of these interfaces are not re-entrant.
Can you not use gethostbyname, gethostbyaddr, etc interfaces that
are implemented in Cygwin?
I'll see if I can dig up my old gethostent/sethostent/endhostent
implementations; if it's still on disk, I'll clean it up and
There are very good sources of information that may help in writing
portable networking code. Unix Network Programming by W. Richard
Stevens is an excellent reference. Advanced Programming in the
UNIX Environment by the same author is also a must-have resource.
Want to unsubscribe from this list?
Send a message to firstname.lastname@example.org
More information about the Cygwin