public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Harish <harish@in.niksun.com>
To: gcc-help@gcc.gnu.org
Subject: Problem with static library linking
Date: Mon, 24 Mar 2008 12:38:00 -0000	[thread overview]
Message-ID: <200803241810.22902.harish@in.niksun.com> (raw)

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


             reply	other threads:[~2008-03-24 12:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-24 12:38 Harish [this message]
2008-03-24 13:00 ` Eljay Love-Jensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200803241810.22902.harish@in.niksun.com \
    --to=harish@in.niksun.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).