Article View: gnu.gcc.help
Article #42333"undefined reference" when linking lib functions w/gcc 2.7.0
From: Jon Andre Chun
Date: Wed, 13 Dec 1995 00:00
Date: Wed, 13 Dec 1995 00:00
46 lines
2080 bytes
2080 bytes
Help! My initial attempts to use gcc2.7.0 on Linux 1.2.13(Slakware 3.0) have repeatedly ended in failure. I've been trying to compile a c program I've written to access mSQL and the shareware program cgiparse.c with gcc with the following commands: 1) gcc -o cgiparse cgiparse.c 2) gcc cgiparse.c 3) cc cgiparse.c 4) gcc -L/var/httpd/lib -lmsql getmsql.c 5) all the above again where I explicitedly copy the needed .h and libxxx.a files to both the local directory I am executing gcc from as well as the system directories /usr/lib and /usr/include. I've also gone so far as to 'chmod a+wrx' all files involved plus I've tried absolute and relative pathes to files in combinations of #include<...> and #include"...". In every single case the command below informs me that the linker is unable to locate these libraries (libxxx.a) and include (xxx.h) files. That is I receive no errors when I stop gcc just before the final link stage with the -c switch: gcc -c -o cgiparse cgiparse.c The error I get when I try to have gcc do linking is the following: gcc -c cgiparse cgiparse.c /tmp/cca004141.o(.text+0xe27): undefined reference to 'HTUnEscape' /tmp/cca004141.o(.text+0x105c): undefined reference to 'HTUnEscape' /tmp/cca004141.o(.text+0x1074): undefined reference to 'HTUnEscape' ... (etc.... every lib function call generates one of these 'undefined reference errors) THE $5,000 QUESTION IS: Why can't gcc find my library and header files to link my program? Where are the pathes stored that gcc uses to search for these files? What am I doing wrong? May your children be numerous and prosper!
Technical Details
Message-ID:
<4altmb$tdq@flood.weeg.uiowa.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,2396443c05fbe1e7,start X-Google-Attributes: gid11318c,public From: jachun@mailhost.net (Jon Andre Chun) Subject: "undefined reference" when linking lib functions w/gcc 2.7.0 Date: 1995/12/13 Message-ID: <4altmb$tdq@flood.weeg.uiowa.edu> X-Deja-AN: 121757917 distribution: world organization: UIHC Internal Medicine newsgroups: gnu.gcc.help