Function and variable next

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2008
Posts: 101
Reputation: Se7Olutionyg has a little shameless behaviour in the past 
Solved Threads: 0
Se7Olutionyg Se7Olutionyg is offline Offline
Junior Poster

Function and variable next

 
0
  #1
Oct 12th, 2008
  1. // file celsius to F
  2. // calculate from c to f in the depth st
  3.  
  4.  
  5. #include <iostream>
  6. using namespace std;
  7.  
  8. float celsiusAtDepth (float);
  9. float CtoF (float);
  10.  
  11. int main ()
  12. {
  13. float depth;
  14. float tempF, tempC;
  15. // get depth
  16.  
  17. cout<< " Enter depth in Km " ;
  18. cin>> depth;
  19.  
  20.  
  21.  
  22.  
  23.  
  24. //calculate temp
  25. tempC = celsiusAtDepth(depth);
  26. tempF = CtoF (tempC);
  27.  
  28.  
  29.  
  30. //display result
  31. cout << " At a depth of " << depth << " km inside the earth , " ;
  32. cout<< "\n the temperature would be : " << tempC << "degrees C , \n the temperature would be " << cout << tempF<< "degree F " << endl;
  33. system ( "pause " ) ;
  34.  
  35. }
  36.  
  37. float celsiusAtdepth ( float depth)
  38.  
  39. {
  40. return ( (10 * depth) +20);
  41. }
  42. float CtoF (float cel)
  43. {
  44. return (cel *1.8 +32 );
  45. }

I dont know what the error with this program ,please help me
Last edited by cscgal; Oct 12th, 2008 at 5:27 am. Reason: Added code tags
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 113
Reputation: ahamed101 is an unknown quantity at this point 
Solved Threads: 14
ahamed101's Avatar
ahamed101 ahamed101 is offline Offline
Junior Poster

Re: Function and variable next

 
0
  #2
Oct 12th, 2008
the function name is different... the prototype has celsiusAtDepth and the definition has celsiusAtdepth...

  1. float celsiusAtDepth (float);
  2.  
  3. float celsiusAtdepth ( float depth)
regards,
Ahamed.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 1,679
Reputation: vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold 
Solved Threads: 193
vmanes's Avatar
vmanes vmanes is offline Offline
Posting Virtuoso

Re: Function and variable next

 
0
  #3
Oct 12th, 2008
Read the error message - what does it say?

Also, please use code tags.

(Hing - check your spelling, capitalization counts.)
Everyone's gotta believe in something. I believe I'll have another drink.
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 101
Reputation: Se7Olutionyg has a little shameless behaviour in the past 
Solved Threads: 0
Se7Olutionyg Se7Olutionyg is offline Offline
Junior Poster

Re: Function and variable next

 
0
  #4
Oct 12th, 2008
it did not run and the compiler said about the linking error sth
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 1,679
Reputation: vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold 
Solved Threads: 193
vmanes's Avatar
vmanes vmanes is offline Offline
Posting Virtuoso

Re: Function and variable next

 
0
  #5
Oct 12th, 2008
Originally Posted by Se7Olutionyg View Post
it did not run and the compiler said about the linking error sth
It will not run because it could not link. What does the linker error say? It should be telling you usefull information that will lead you to the solution.

RTFEM (Read The Full Error Message)
Everyone's gotta believe in something. I believe I'll have another drink.
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 390
Reputation: skatamatic will become famous soon enough skatamatic will become famous soon enough 
Solved Threads: 39
skatamatic skatamatic is offline Offline
Posting Whiz

Re: Function and variable next

 
0
  #6
Oct 12th, 2008
Generally a link error occurs when the linker cannot resolve a function to its declaration. The solution to this was already posted.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 415 | Replies: 5
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC