Click here to Skip to main content
15,923,689 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Win32 Tree Question Pin
Michael Dunn25-Jun-02 17:51
sitebuilderMichael Dunn25-Jun-02 17:51 
GeneralRe: Win32 Tree Question Pin
NullStream25-Jun-02 19:01
NullStream25-Jun-02 19:01 
GeneralRe: Win32 Tree Question Pin
Rage25-Jun-02 22:39
professionalRage25-Jun-02 22:39 
GeneralRe: Win32 Tree Question Pin
Roger Broomfield26-Jun-02 0:52
Roger Broomfield26-Jun-02 0:52 
GeneralRe: Win32 Tree Question Pin
NullStream26-Jun-02 1:24
NullStream26-Jun-02 1:24 
GeneralRe: Win32 Tree Question Pin
Roger Broomfield26-Jun-02 3:25
Roger Broomfield26-Jun-02 3:25 
GeneralRe: Win32 Tree Question Pin
NullStream26-Jun-02 21:45
NullStream26-Jun-02 21:45 
Generallinking errors LNK2001 Pin
Dee25-Jun-02 17:21
Dee25-Jun-02 17:21 
When I build my bank.cpp file, I get these linking errors. I don't understand these coding errors, I would appreciate any help you could give me.


Linking...
Bank.obj : error LNK2001: unresolved external symbol "public: class Account & __thiscall Customer::getchecking(void)" (?getchecking@Customer@@QAEAAVAccount@@XZ)
Bank.obj : error LNK2001: unresolved external symbol "public: void __thiscall Account::setbalance(float)" (?setbalance@Account@@QAEXM@Z)
Bank.obj : error LNK2001: unresolved external symbol "public: void __thiscall Account::setnum(int)" (?setnum@Account@@QAEXH@Z)
Bank.obj : error LNK2001: unresolved external symbol "public: class Account & __thiscall Customer::getsavings(void)" (?getsavings@Customer@@QAEAAVAccount@@XZ)
Bank.obj : error LNK2001: unresolved external symbol "public: void __thiscall Customer::setpin(int)" (?setpin@Customer@@QAEXH@Z)
Bank.obj : error LNK2001: unresolved external symbol "public: __thiscall Customer::Customer(void)" (??0Customer@@QAE@XZ)
Bank.obj : error LNK2001: unresolved external symbol "public: float __thiscall Account::getbalance(void)" (?getbalance@Account@@QAEMXZ)
Bank.obj : error LNK2001: unresolved external symbol "public: int __thiscall Account::getnum(void)" (?getnum@Account@@QAEHXZ)
Bank.obj : error LNK2001: unresolved external symbol "public: int __thiscall Customer::getpin(void)" (?getpin@Customer@@QAEHXZ)
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Bank.exe : fatal error LNK1120: 10 unresolved externals
Error executing link.exe.

Bank.exe - 11 error(s), 0 warning(s)

This is my bank.cpp file.............................
#include "Bank.h"
#include <fstream.h>

Bank::Bank()
{
numcustomers=0;
companyname="";
}
int Bank::getNumcustomers()
{return numcustomers;}

char * Bank::getCompanyname()
{return companyname;}

Customer& Bank::getCustomer(int index)
{ return customers[index];}

void Bank::setNumcustomers(int n)
{ numcustomers=n; }

void Bank::setCompanyname(char * c)
{ companyname =c;}


void Bank::setCustomer(Customer &c,int index)
{customers[index]= c;}



bool Bank::readCustomers()
{
ifstream infile;
infile.open("customers.dat");

if(!infile)
{
return false;
}
else
{ infile>>numcustomers;
int numberpin=0;
int cksavnumber=0;
float savckbalance=0.00f;


customers = new Customer[numcustomers];
for(int x1=0;x1<=numcustomers;x1++)
{
infile>>numberpin;
infile>>cksavnumber;
infile>>savckbalance;

customers [x1].setpin(numberpin);
customers[x1].getsavings().setnum(cksavnumber);
customers[x1].getsavings().setbalance(savckbalance);
infile>>cksavnumber;
infile>>savckbalance;
customers[x1].getchecking().setnum(cksavnumber);
customers[x1].getchecking().setbalance(savckbalance);

}
infile.close();
}
return true;
}

bool Bank::writeCustomers()
{
ofstream outfile;
outfile.open("newcustomers.dat");

if(!outfile)
{
return false;
}
else
{ outfile<<numcustomers;
for(int="" x1="0;x1<=numcustomers;x1++)
" {
="" outfile="" <<="" customers="" [x1].getpin()="" "\t";
="" outfile<<customers="" [x1].getsavings().getnum()<<="" [x1].getsavings().getbalance()<<="" [x1].getchecking().getnum()<<="" [x1].getchecking().getbalance()<<="" endl;

="" }
="" outfile.close();
="" return="" true;
="" }
int="" bank::checkpin(int="" pin)
{="" for="" (int="" x1<="numcustomers;" x1++)
="" {="" if="" (customers[x1].getpin()="=pin)
" x1;
="" -1;
}

int="" bank::menu()
{="" int="" choice="1;
" cout<<"withdraw";
="" cout<<"deposit";
="" cout<<"transfer";
="" cout<<"display="" balances";
="" cout<<"exit";

="" choice;
}
bool="" bank::withdraw(float="" amount,account="" a)=""
{
if(amount="">a.getbalance())
{
return false;
}
else
{ a.setbalance(a.getbalance()- amount);
return true;
}
}
void Bank::deposit(float amount,Account a)
{a.setbalance(a.getbalance()+ amount);}

bool Bank::transfer(float amount,Account s,Account c)
{
int targetaccount=0;
do
{

cout<<"From which account"<<endl;
cout<<"1-checking"<<endl;
cout<<"2-saving"<<endl;
cin>>targetaccount;
if ((targetaccount!=1)&&(targetaccount !=2))
cout<<"INVALID Choice"<<endl<<endl;
} while="" ((targetaccount!="1)&&(targetaccount" !="2));
if(targetaccount==1)
{"
if="" (amount="">c.getbalance())
return false;
}
else
{
c.setbalance(c.getbalance()-amount);
s.setbalance(s.getbalance()+amount);
}
if(targetaccount==2)
{
if (amount>s.getbalance())
return false;
}
else
{
c.setbalance(c.getbalance()+amount);
s.setbalance(s.getbalance()-amount);
}
return true;
}

void Bank::displayBalance(int index)
{
cout<<"This is your savings account balance: $ "<<customers[index].getsavings().getbalance()<<endl;
cout<<"this="" is="" your="" checking="" account="" balance:="" $="" "<<customers[index].getchecking().getbalance()<<endl;
=""
}
account.cpp="" .........................................
#include="" "account.h"

account::account()
{
="" num="0;
" type="0;
" balance="0.00f;
}

Account::Account(int" n,int="" t,float="" b)
{
="" account::setnum="" (int="" n)
{
="" account::settype="" t)
{
="" account::setbalance(float="" account::getnum()
{
="" return="" num;
}
int="" account::gettype()
{
="" type;
}
float="" account::getbalance()
{
="" balance;
}


my="" void="" main...........................................
#="" include="" <iostream.h="">
# include "account.cpp"
# include "customer.cpp"
# include "bank.cpp"
# include <stdlib.h>


int getaccount();
float getamount();
Bank Chase;
Customer clientme;
void main()
{
int index=-1, pin =0, numtries=1;
Chase.setCompanyname("Chase");

if(!Chase.readCustomers())
{ cout<<"Account not in database!"<<endl;
exit(0);

="" }
="" do
="" {="" cout<<"enter="" your="" password:";
="" cin="">>pin;
index=Chase.checkPin(pin);
if((index==-1) && (numtries<=3))
{numtries++;
cout<<"Password incorrect,try again."<<endl;

="" }
="" }="" while="" ((index="=-1)&&(numtries<=3));
"

="" if="" (numtries="">3)
{ cout<<"Transaction denied!, Number of tries exceeded"<<endl;
exit="" (0);

="" }
=""
="" switch="" (chase.menu())

="" {="" case="" 1:
="" if(getaccount()="=1)
" if(chase.withdraw(getamount(),clientme.getchecking()))
="" cout<<"transaction="" successful!"="" <<endl;
="" else
="" cout<<"insufficient="" funds!"<<endl;
="" cout<<"your="" checking="" balance="" is!"<<clientme.getchecking().getbalance()<<endl;
="" if="" (chase.withdraw(getamount(),clientme.getsavings()))
="" successful!"<<endl;
="" savings="" is!"<<clientme.getsavings().getbalance()<<endl;

="" break;
="" 2:
="" {
="" (getaccount()="=1)
" chase.deposit(getamount(),="" clientme.getchecking());
="" is!"<<clientme.getsavings().getbalance()<<endl;="" clientme.getsavings());
="" is"<<clientme.getsavings().getbalance()<<endl;
="" 3:
="" (chase.transfer(getamount(),="" clientme.getchecking(),="" clientme.getsavings()))
="" is="" !"<<clientme.getchecking().getbalance()<<endl;
="" is!"<<clientme.getsavings().getbalance()<<endl;
="" 4:
="" chase.setcustomer(clientme,="" index);
="" chase.displaybalance(index);
="" 5:
="" chase.writecustomers();
="" cout<<"thank="" you="" for="" banking="" with="" chase!!"<<endl;
="" float="" getamount()
="" amount="0.00f;
" cout<<"enter="" of="" transaction:";
="" cin="">>amount;
return amount;
}
int getaccount()
{
int account;
do
{
cout<<"Which account would you like to withdraw from (1-Checking 2-Savings)?:";
cin>>account;
if ((account<1)|| (account>2))
cout<<"account is invalid, Try Again!" <<endl<<endl;
}="" while="" ((account<1)="" ||="" (account="">2));

return account;

}
GeneralRe: linking errors LNK2001 Pin
Christian Graus25-Jun-02 19:47
protectorChristian Graus25-Jun-02 19:47 
QuestionHow to change the size of a splitview? Pin
aldeba25-Jun-02 16:44
aldeba25-Jun-02 16:44 
AnswerRe: How to change the size of a splitview? Pin
aldeba25-Jun-02 16:54
aldeba25-Jun-02 16:54 
QuestionDirectly creating a CFormView as a child? Pin
DerekSaw25-Jun-02 16:34
DerekSaw25-Jun-02 16:34 
AnswerRe: Directly creating a CFormView as a child? Pin
aldeba25-Jun-02 16:45
aldeba25-Jun-02 16:45 
AnswerRe: Directly creating a CFormView as a child? Pin
DerekSaw25-Jun-02 16:52
DerekSaw25-Jun-02 16:52 
GeneralRe: Directly creating a CFormView as a child? Pin
aldeba25-Jun-02 19:58
aldeba25-Jun-02 19:58 
GeneralRe: Directly creating a CFormView as a child? Pin
DerekSaw25-Jun-02 22:06
DerekSaw25-Jun-02 22:06 
GeneralRe: Directly creating a CFormView as a child? Pin
Michael P Butler25-Jun-02 22:28
Michael P Butler25-Jun-02 22:28 
GeneralUse of class template Pin
Coremn25-Jun-02 16:22
Coremn25-Jun-02 16:22 
GeneralRe: Use of class template Pin
Joaquín M López Muñoz25-Jun-02 20:09
Joaquín M López Muñoz25-Jun-02 20:09 
GeneralHTTP Mime Post Parser Pin
25-Jun-02 14:14
suss25-Jun-02 14:14 
GeneralRe: HTTP Mime Post Parser Pin
26-Jun-02 7:20
suss26-Jun-02 7:20 
GeneralErrors Pin
25-Jun-02 13:42
suss25-Jun-02 13:42 
GeneralpDC->GetTextExtent() returns different results at different times Pin
JennyP25-Jun-02 13:36
JennyP25-Jun-02 13:36 
GeneralRe: pDC->GetTextExtent() returns different results at different times Pin
Jason Henderson25-Jun-02 16:55
Jason Henderson25-Jun-02 16:55 
GeneralRe: pDC->GetTextExtent() returns different results at different times Pin
Rage25-Jun-02 22:04
professionalRage25-Jun-02 22:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.