public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Problem with static library linking
@ 2008-03-24 12:38 Harish
  2008-03-24 13:00 ` Eljay Love-Jensen
  0 siblings, 1 reply; 2+ messages in thread
From: Harish @ 2008-03-24 12:38 UTC (permalink / raw)
  To: gcc-help

Hi,

I am having a problem with the static library as explained below.


There was an existing static library libpcap.a 
I created a new static library with the name mylib.a , mylib.a calls a function func() in libpcap.a.

I created mylib.a using the below command

ar rcs mylib.a *.o libpcap.a
ranlib mylib.a

mylib.a has been successfully made. 

But when I use mylib.a with an executable it says undefined symbol for the function func() in the file which is present in mylib.a.

I used the command "nm mylib.a | grep func" to verify that mylib.a actually contains func().

But still I am getting linking error.

In my link line  libpcap.a comes before mylib.a

Could you please help.

I would be very thankful.

-Harish


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-03-24 13:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-24 12:38 Problem with static library linking Harish
2008-03-24 13:00 ` Eljay Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).