This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Beginner's question on libraries


Tony,

Make sure that the library comes last on the command line.  For example,
you should be linking something like this:

gcc -o prog prog.c -L/lib/dir -lwebs

I posted another message a little while back explaining why you need to
do this.  If you're motivated, you could search through archives to find
it...

Good luck,
Lyle

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Anthony Tonizzo
Sent: Sunday, February 22, 2004 1:57 PM
To: gcc-help@gcc.gnu.org
Subject: Beginner's question on libraries

Hi,

I am just begining to use GCC and I stumbled on a problem
I do not seem to get myself out of, yet I think the 
solution is very simple.

I have a library which I compiled, whose entry point is
defined as such:

static void webs_thread( cyg_addrword_t p )

I can compile the library (libwebs.a), but when I try to 
link the library in my code and use the function webs_thread 
I come up with a 

'undefined reference to `webs_thread'

I have the -L switch set to the correct path, and the 
-lwebs is there too. The problem does not seem to be 
that the libwebs.a library is not found, but rather that 
the link cannot be made.

I am not sure this is all the information that is 
necessary to diagnose the problem and educate me on the
issue, but I would surely appreciate any help I can get.

Thanks
Tony



____________________________________________________________
Find what you are looking for with the Lycos Yellow Pages
http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default
.asp?SRC=lycos10


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]