error C2447: '{' : missing function header (old-style formal list?)

Thread Solved

Join Date: Jul 2008
Posts: 38
Reputation: plike922 is an unknown quantity at this point 
Solved Threads: 0
plike922's Avatar
plike922 plike922 is offline Offline
Light Poster

error C2447: '{' : missing function header (old-style formal list?)

 
0
  #1
Jul 23rd, 2008
I am trying to fix this "error C2447: '{' : missing function header (old-style formal list?)" i looked over the program and cant find anything wrong. Here is my program.
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include "simpio.h"
  4. #include "strlib.h"
  5. #include "random.h"
  6. using namespace std;
  7.  
  8. #define LowerLimit 0
  9. #define UpperLimit 200
  10. #define StepSize 20
  11.  
  12. double CelsiusToFahrenheit(double c);
  13.  
  14. int main()
  15. {
  16. int c;
  17.  
  18. printf("Fahrenheit Celsius");
  19. for (c = LowerLimit; c <= UpperLimit; c += StepSize)
  20. {
  21. printf("%3d %f\n", c, CelsiusToFahrenheit(c));
  22. }
  23. system("pause");
  24. }
  25.  
  26. double CelsiusToFahrenheit(double c);
  27. {
  28. return (9.0 / 5.0 * c + 32);
  29. }
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 978
Reputation: mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice mitrmkar is just really nice 
Solved Threads: 208
mitrmkar mitrmkar is offline Offline
Posting Shark

Re: error C2447: '{' : missing function header (old-style formal list?)

 
0
  #2
Jul 23rd, 2008
...
double CelsiusToFahrenheit(double c);
...
int main()
{
...
}

double CelsiusToFahrenheit(double c) ; // <- remove the semicolon
{
	return (9.0 / 5.0 * c + 32);
}
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 38
Reputation: plike922 is an unknown quantity at this point 
Solved Threads: 0
plike922's Avatar
plike922 plike922 is offline Offline
Light Poster

Re: error C2447: '{' : missing function header (old-style formal list?)

 
0
  #3
Jul 23rd, 2008
Thanks
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 241
Reputation: ssharish2005 is on a distinguished road 
Solved Threads: 20
ssharish2005's Avatar
ssharish2005 ssharish2005 is offline Offline
Posting Whiz in Training

Re: error C2447: '{' : missing function header (old-style formal list?)

 
0
  #4
Jul 23rd, 2008
Perhaps, you should have posted this question on a C++ form .

And few things which I saw in your code, which you might have to consider to correcting

  1. #include <stdio.h>
  2. to
  3. #include <cstdio>

And main should return a value. Well, it’s already if you don’t specify it as well, under C99 it automatically assumes to be return 0. But it is always a good practice to place them explicitly.

  1. system("PAUSE");
Using system function is not very portable. You might have to consider using some different function. Have a look this thread
http://www.daniweb.com/forums/thread90228.html

NOTE: I still wonder why do you consider including

  1. #include <iostream>
  2. and
  3. using namespace std;
You are just mixing up languages. Did anybody guide you to do that??

ssharish
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 38
Reputation: plike922 is an unknown quantity at this point 
Solved Threads: 0
plike922's Avatar
plike922 plike922 is offline Offline
Light Poster

Re: error C2447: '{' : missing function header (old-style formal list?)

 
0
  #5
Jul 25th, 2008
I have the same problem again but with a different program, any suggestions.

  1. #include <iostream>
  2. #include <stdio.h>
  3. #include "simpio.h"
  4. #include "strlib.h"
  5.  
  6. #define GCD();
  7.  
  8. int main()
  9. {
  10. int x, y, g;
  11.  
  12. printf("1st number = ");
  13. x = GetInteger();
  14.  
  15. printf("2nd number = ");
  16. y = GetInteger();
  17.  
  18. printf("The GCD of %d and %d is %d", x, y, g);
  19. }
  20.  
  21. int GCD(int x, int y)
  22. {
  23. int g;
  24.  
  25. g = x;
  26. while (x % g != 0 || y % g != 0)
  27. {
  28. g--;
  29. }
  30. return (g);
  31. }
_________________________
||||||||||[][][]|||||||||||||||||||
|||||||||||||||____|
||||||||||
||||||||||
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 241
Reputation: ssharish2005 is on a distinguished road 
Solved Threads: 20
ssharish2005's Avatar
ssharish2005 ssharish2005 is offline Offline
Posting Whiz in Training

Re: error C2447: '{' : missing function header (old-style formal list?)

 
1
  #6
Jul 25th, 2008
#define GCD();
Take of that semicolon from that statment. Macros donst need a semicolon. If your marco definiation are like too big then you might use a '\' to speak it up and concatenate.

But for you just the semicolon off.

ssharish
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 38
Reputation: plike922 is an unknown quantity at this point 
Solved Threads: 0
plike922's Avatar
plike922 plike922 is offline Offline
Light Poster

Re: error C2447: '{' : missing function header (old-style formal list?)

 
0
  #7
Jul 25th, 2008
That can't be it because i still have the same problem but get another one
_________________________
||||||||||[][][]|||||||||||||||||||
|||||||||||||||____|
||||||||||
||||||||||
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 241
Reputation: ssharish2005 is on a distinguished road 
Solved Threads: 20
ssharish2005's Avatar
ssharish2005 ssharish2005 is offline Offline
Posting Whiz in Training

Re: error C2447: '{' : missing function header (old-style formal list?)

 
0
  #8
Jul 25th, 2008
Well, i could see some other problem as well now with that code. Can you please post the error message please

ssharish
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3,818
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 501
Featured Poster
VernonDozier VernonDozier is offline Offline
Senior Poster

Re: error C2447: '{' : missing function header (old-style formal list?)

 
0
  #9
Jul 25th, 2008
I question whether you want to #define this function instead of just declaring it at the top. Try replacing


  1. #define GCD();

with this:

  1. int GCD(int x, int y);
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