RE: Beginner's question on libraries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On
Behalf Of Anthony Tonizzo
Sent: Sunday, February 22, 2004 1:57 PM
To: gcc-help@xxxxxxxxxxx
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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux