Linker Errors

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Oct 2007
Posts: 60
Reputation: guitarrick is an unknown quantity at this point 
Solved Threads: 0
guitarrick guitarrick is offline Offline
Junior Poster in Training

Linker Errors

 
0
  #1
Jan 3rd, 2008
Hello everyone. Happy New Year. I've been going over last semester's book and have found that I've already allowed the basics to run away! We ended with classes, so I've gone back to just doing exercises with basic functions and I keep getting a linker on this one.:
Takes input for the amount a consumer needs to borrow(in-pocket), the interest rate, and duration of loan in months. Program should calculate the "face value" of loan (with interest) as well as monthly payment. Please excuse my sloppy code, I just don't see this:

  1. #include <iostream>
  2. using namespace std;
  3.  
  4. double paid_out, rate, time, interest, in_pocket, months, monthly_payment;
  5. double loan_value(double rate, double time, double interest, double in_pocket);
  6. double payment(double monthly, double paid_out);
  7.  
  8.  
  9. double loan_value( double rate, double time, double interest, double in_pocket)
  10. {
  11. paid_out = (in_pocket) / (1 - rate * time);
  12. return 0;
  13. }
  14. double payment(double months, double paid_out)
  15. {
  16. monthly_payment = (paid_out / months);
  17. return 0;
  18. }
Last edited by Ancient Dragon; Jan 3rd, 2008 at 1:45 pm. Reason: corrected code tags
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 1,311
Reputation: vishesh is on a distinguished road 
Solved Threads: 36
vishesh's Avatar
vishesh vishesh is offline Offline
Nearly a Posting Virtuoso

Re: Linker Errors

 
0
  #2
Jan 3rd, 2008
What linker errors are you getting? You have just declared the function paidout() but not defined it. And perhaps you have called it somewhere else. Also if you think thats the whole program then its wrong, you haven't written main function. That too could be a cause.
Last edited by vishesh; Jan 3rd, 2008 at 1:34 pm.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 60
Reputation: guitarrick is an unknown quantity at this point 
Solved Threads: 0
guitarrick guitarrick is offline Offline
Junior Poster in Training

Re: Linker Errors

 
0
  #3
Jan 3rd, 2008
Thanks. Yes, I was trying to develop a new habit of checking for errors as I proceed, debugging as you go, because I had a bad habit of tying to write the whole thing and then the errors would be too overwhelming. Can I do this somehow without calling the functions in a main? Or won't that be possible?
Thanks
RG
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 176
Reputation: dubeyprateek is an unknown quantity at this point 
Solved Threads: 22
dubeyprateek's Avatar
dubeyprateek dubeyprateek is offline Offline
Junior Poster

Re: Linker Errors

 
0
  #4
Jan 3rd, 2008
What is the error? Linking errors are different than syntactical error one can't find them looking at the code.
I know I am. Therefore I am.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 60
Reputation: guitarrick is an unknown quantity at this point 
Solved Threads: 0
guitarrick guitarrick is offline Offline
Junior Poster in Training

Re: Linker Errors

 
0
  #5
Jan 3rd, 2008
It's resolved. I needed to write my main with function calls I guess you just get linkers without writing a call in main first?
Thanx for the help!!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC