public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "joe_squid@sbcglobal.net" <joe_squid@sbcglobal.net>
To: <gcc-help@gcc.gnu.org>
Subject: Linker Problem
Date: Sat, 16 Sep 2006 21:08:00 -0000	[thread overview]
Message-ID: <450C67DB.000007.02764@HARMONY> (raw)

I am having a problem with the linker. When the linker reaches this bit of
code:
 
    anAccount[arrayPosition].setAccountNumber(acctNum);
 
It displays the following message:
 
  [Linker error] undefined reference to `Account::setAccountNumber(int)' 
 
This bit of code appears in a function I have placed in the main.cpp file. I
have several other similar lines of code in other such functions, and all
are giving me the same error. All of these such functions are called by
main(), and all are prototyped and implemented within the main.cpp file. 
I thought that maybe anAccount was out of scope, but that does not seem to
be the case. I had to declare it as a global variable, since declaring it
directly in main resulted in it not being visible to my other functions.
However, declaring it this way does not result in the linker error, although
I believe that these errors appear before the linker is reached, so I do not
know if the linker errors would still exist if I could devise another way of
declaring anAccount so that it would stay in scope. Any help you could
provide would be greatly appreciated.
 
 
 
Thanks,
Joe Hayes

             reply	other threads:[~2006-09-16 21:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-16 21:08 joe_squid [this message]
2006-09-17  4:57 ` Ravishankar S
  -- strict thread matches above, loose matches on Subject: below --
2006-04-23  3:28 A question about a MACRO,EXPORT_SYMBOL Brian Dessent
2006-04-25 14:00 ` linker problem Javier Cuevas
2006-04-25 14:09   ` John Love-Jensen
2006-04-25 14:48     ` Perry Smith
2005-08-31  8:38 Linker problem Jakub Horn (jakuhorn)
2005-08-31  8:49 ` Brian Dessent
2001-11-02 13:14 Rudy Gingles
2001-10-19 20:23 Linker Problem Chandra Sekhar G
2001-10-12  9:05 linker problem thomas.porschberg
2001-10-12 10:39 ` hiufungeric.tse
1999-10-01  0:00 Linker problem The G

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=450C67DB.000007.02764@HARMONY \
    --to=joe_squid@sbcglobal.net \
    --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).