From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,c86f7555baa8a3af X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2002-07-02 07:49:00 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!newsfeed.news2me.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail Sender: paul@salmon.parasoft.com Newsgroups: comp.unix.tru64 Subject: Re: gcc and gethostbyname: where is the library References: From: Paul Pluzhnikov User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence) Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 02 Jul 2002 14:49:00 GMT NNTP-Posting-Host: 24.205.81.188 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 1025621340 24.205.81.188 (Tue, 02 Jul 2002 07:49:00 PDT) NNTP-Posting-Date: Tue, 02 Jul 2002 07:49:00 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.unix.tru64:8033 alex writes: > I cannot figure out why gcc cannot link the following file: > >cat a.cpp ... > /usr/bin/ld: > Unresolved: > gethostbyname(char const *) What this means is that 'gethostbyname' has aquired C++ linkage, and the linker is now looking for gethostbyname__FPCc (which is not there). So it is a compilation problem. However I can not reproduce this using gcc-2.95.3 on a 5.0 system. Perhaps if you add 'extern "C" struct hostent *gethostbyname(const char *);' somewhere after 'netdb.h' gcc will either stop C++mangling or tell you where "bad" gethostbyname prototype is coming from. Cheers, -- In order to understand recursion you must first understand recursion.