W3C home > Mailing lists > Public > www-lib@w3.org > July to September 2004

more about undefined error

From: zhu mingyu <frankzhu_2002@hotmail.com>
Date: Wed, 04 Aug 2004 15:24:18 -0700
To: www-lib@w3.org
Message-ID: <BAY13-F9NNBg8j29h8700023f37@hotmail.com>

Hi, 
I have browse though the archives and found a lot of people ask why link 
produce such error, but I haven't found a good solution to that. I'd like 
to hear any answer for this kind of problem , with my additional 
information.

My build command is,
gcc -g -o test `libwww-config --cflags` library/examples/libapp_2.c 
`libwww-config --libs`

error message is,
/usr/local/lib/libwwwstream.a(HTFSave.o)(.text+0x563): In function 
`HTSaveLocally':
/usr/w3c-libwww-5.4.0/Library/src/HTFSave.c:189: undefined reference to 
`_HTBind_getSuffix'
/usr/local/lib/libwwwstream.a(HTFSave.o)(.text+0x7af): In function 
`HTSaveAndExecute':
/usr/w3c-libwww-5.4.0/Library/src/HTFSave.c:254: undefined reference to 
`_HTBind_getSuffix'
collect2: ld returned 1 exit status


By explicitly specify the external object, I can pass the build by
gcc -g -o test `libwww-config --cflags` library/examples/libapp_2.c 
`libwww-config --libs` library/src/htbind.o /library/src/htchunk.o

Since I can't always do build by adding objects manually, I'd like to know 
why it fails in the first case.

BTW, i've done another experiment as the following,
1. touch libapp_2.c
2. make |less
This will force gcc to make libapp.exe again. I can see it pass with the 
following compile/link options,

Entering directory `/usr/w3c-libwww-5.4.0/Library/Examples'
gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I./../src 	
-I../../modules/expat/xmlparse 	-I./../src/SSL    -g -O2 -Wall -c 
libapp_2.c
/bin/sh ../../libtool --mode=link gcc  -g -O2 -Wall  -o libapp_2.exe  
libapp_2.o ../src/libwwwinit.la 	../src/libwwwapp.la 	
.../../Library/src/libwwwxml.la ../../modules/expat/xmlparse/libxmlparse.la 
.../../modules/expat/xmltok/libxmltok.la ../src/libwwwhtml.la 	
.../src/libwwwtelnet.la 	../src/libwwwnews.la 	../src/libwwwhttp.la 	
.../src/libwwwmime.la 	../src/libwwwgopher.la 	../src/libwwwftp.la 	
.../src/libwwwdir.la 	../src/libwwwcache.la 	../src/libwwwstream.la 	
.../src/libwwwfile.la 	../src/libwwwmux.la 	../src/libwwwtrans.la 	
.../src/libwwwcore.la 	../src/libwwwutils.la          	 	-lm    
.../../modules/md5/libmd5.la 
gcc -g -O2 -Wall -o libapp_2.exe libapp_2.o  ../src/.libs/libwwwinit.a 
.../src/.libs/libwwwapp.a ../../Library/src/.libs/libwwwxml.a 
.../../modules/expat/xmlparse/.libs/libxmlparse.a 
.../../modules/expat/xmltok/.libs/libxmltok.a ../src/.libs/libwwwhtml.a 
.../src/.libs/libwwwtelnet.a ../src/.libs/libwwwnews.a 
.../src/.libs/libwwwhttp.a ../src/.libs/libwwwmime.a 
.../src/.libs/libwwwgopher.a ../src/.libs/libwwwftp.a 
.../src/.libs/libwwwdir.a ../src/.libs/libwwwcache.a 
.../src/.libs/libwwwstream.a ../src/.libs/libwwwfile.a 
.../src/.libs/libwwwmux.a ../src/.libs/libwwwtrans.a 
.../src/.libs/libwwhttp://by13fd.bay13.hotmail.msn.com/cgi-bin/compose?&curmbox=F000000002&a=e42d35f410371000112b69c0c9f00cb4#

发送wcore.a ../src/.libs/libwwwutils.a ../../modules/md5/.libs/libmd5.a

My platform is cygwin, gcc version is 3.3.1

_________________________________________________________________
享用世界上最大的电子邮件系统— MSN Hotmail。  http://www.hotmail.com  
Received on Wednesday, 4 August 2004 19:16:28 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:44 GMT