public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Iker Arizmendi <iker@research.att.com>
To: Iker Arizmendi <iker@research.att.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: static library and undefined reference
Date: Fri, 09 Apr 2004 03:46:00 -0000	[thread overview]
Message-ID: <40761BB8.2080903@research.att.com> (raw)
In-Reply-To: <40761790.1080401@research.att.com>

After reading a helpful post on the topic which describes
that linker will "throw away" a library if it comes across
it but none of the symbols it defines are needed, I realized
that my link line was wrong. The problem was not between
my executable and my library but between my two libraries.
I had placed the "depended on" library first thinking that
the symbols should be available when they were needed (which
explains why I got errors when my executable's .o was placed
before or after the libraries).

Regards,
Iker

Iker Arizmendi wrote:
> Just a quick follow up - when I put the static libraries
> _after_ the executable's .o file I get _more_ undefined
> reference errors.
> 
> Iker
> 
> 
> Iker Arizmendi wrote:
> 
>> Hello all.
>>
>> I have a project that creates several static libraries
>> in two directories and an executable that uses them in
>> a third. The libraries build just fine, and the
>> executable builds fine, but fails during linking with
>> "undefined reference" errors. I've checked the libraries
>> with nm and can see that the symbols the linker claims
>> are undefined are exported (nm shows marks them with
>> a "T"). I've checked that the link line includes the
>> libraries and that libraries that are depended on by
>> other libraries appear first (and before the executable's
>> .o file). I also made sure that all the files involved
>> were compiled with g++ and not gcc. But the errors persist.
>>
>> What am I missing here? Any help greatly appreciated.
>>
>> Regards,
>> Iker
>>
>>
>>
> 
> 
> 
> 

  reply	other threads:[~2004-04-09  3:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-09  2:45 Iker Arizmendi
2004-04-09  3:28 ` Iker Arizmendi
2004-04-09  3:46   ` Iker Arizmendi [this message]
2004-04-09 13:17 ` 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=40761BB8.2080903@research.att.com \
    --to=iker@research.att.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).