Article View: gnu.gcc.help
Article #52601gcc 2.2.2 linking problem: gethostbyname
From: Ken Warkentyne
Date: Fri, 26 Jun 1992 15:14
Date: Fri, 26 Jun 1992 15:14
31 lines
1810 bytes
1810 bytes
Here is a small program that is supposed to find out if the machine on which it
is executing is the "localhost".
----file bob.c----
#include <netdb.h>
main()
{
int not_local;
char localname[255];
struct hostent *hst = gethostbyname ("localhost");
not_local = !hst || !!(strcmp (localname, hst->h_name));
printf("%d\n",not_local);
}
----eof----
When I try to compile this by typing "gcc bob.c", I get the following error messages:
gethostnamadr.o: undefined reference to `__GLOBAL_OFFSET_TABLE_'
...
gethostnamadr.o: more undefined references to `__GLOBAL_OFFSET_TABLE_' follow
The ld program is the GNU version from binutils-beta-1.94.
I should add that I did not follow the fixincludes procedure recommended in the gcc
INSTALL file. I had already cleaned up the directory when it came to mind to
do the fixincludes. Unfortunately, typing "make install-fixincludes" seemed to
start compiling the compiler again. So I killed the 'make' and executed the
fixincludes script by hand.
--
Ken Warkentyne - warkent@ltisun.epfl.ch
Laboratoire de Teleinformatique, EPFL, Suisse.
Technical Details
Message-ID:
<WARKENT.92Jun26171407@ltisun9.epfl.ch>Path:
arc1-ca.pugleaf.net!sparky!uunet!darwin.sura.net!Sirius.dfn.de!chx400!sicsun!disuns2!warkentShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,b6bc61d46913c24f,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1992-06-26 03:17:10 PST Path: arc1-ca.pugleaf.net!sparky!uunet!darwin.sura.net!Sirius.dfn.de!chx400!sicsun!disuns2!warkent From: warkent@ltisun9.epfl.ch (Ken Warkentyne) Newsgroups: gnu.gcc.help Subject: gcc 2.2.2 linking problem: gethostbyname Message-ID: <WARKENT.92Jun26171407@ltisun9.epfl.ch> Date: 26 Jun 92 15:14:07 GMT Sender: news@disuns2.epfl.ch Distribution: gnu Organization: Ecole Polytechnique Federale de Lausanne---Laboratoire de Teleinformatique Lines: 31 Nntp-Posting-Host: ltisun9.epfl.ch