Linker Problem

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

 



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

[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