5 Replies - 1226 Views - Last Post: 21 June 2009 - 05:55 AM Rate Topic: -----

#1 galaris  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 14-June 09

C2447 error, missing '{' function header

Post icon  Posted 20 June 2009 - 11:38 AM

Hy!

I try to compile this source code:

#include <iostream>
#include <windows.h>

int a;
int b;
int c;
int choose;

void core(); {

	std::cout << "asd" << std::endl;
}

int main() {

	std::cout << " Ird be hogy 1!" << std::endl;
	std::cin >> choose;
	if (choose == 1) {
		core();
						 }
	else				 {
		return 0;		}

return 0;
}


gives me this error:

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

what the duck is this? :(

Please help! thanks! :rolleyes:

Is This A Good Question/Topic? 0
  • +

Replies To: C2447 error, missing '{' function header

#2 IngeniousHax  Icon User is offline

  • |>|20-514<|{3|2

Reputation: 78
  • View blog
  • Posts: 1,358
  • Joined: 28-March 09

Re: C2447 error, missing '{' function header

Posted 20 June 2009 - 11:42 AM


#include <iostream>
#include <windows.h>

int a;
int b;
int c;
int choose;

void core(); { /* Rethink this portion cause it's wrong */

	std::cout << "asd" << std::endl;
}

int main() {

	std::cout << " Ird be hogy 1!" << std::endl;
	std::cin >> choose;
	if (choose == 1) {
		core();
						 }
	else				 {
		return 0;		}

return 0;
}



try looking up how to use functions, either declare them above and build them below, or build them above, either way is fine, but you gotta remove the ' ; ' from the function if you wanna build it above.

Also, try looking into using namespace std; ...Saves a lot of time

This post has been edited by IngeniousHax: 20 June 2009 - 11:43 AM

Was This Post Helpful? 0
  • +
  • -

#3 galaris  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 14-June 09

Re: C2447 error, missing '{' function header

Posted 20 June 2009 - 12:41 PM

This is the code, i want to do, and i got that error message.
Could you post a fixed code for me please, maybe i understand it :)

Thank you for you help! :wub: :D

#include <iostream>
#include <windows.h>

int a;
int b;
int c;
int choose;

void core(); { /* Rethink this portion cause it's wrong */

system("color F8");
system("title Test Console program by Homer");

	   keybd_event(VK_MENU, //fullscreen code from this point (start)

	   0x38,

	   0,

	   0);

	 keybd_event(VK_RETURN,

	   0x1c,

	   0,

	   0);

	 keybd_event(VK_RETURN,

	   0x1c,

	   KEYEVENTF_KEYUP,

	   0);

	 keybd_event(VK_MENU,

	   0x38,

	   KEYEVENTF_KEYUP,

	   0);				   ////fullscreen code to this point (end)
	
	std::cout << "\n" << std::endl;
	std::cout << " Hello!\n" << std::endl;
	std::cout << " In this program, I'll test the ELSE, IF commands. " << std::endl;
	std::cout << " So, lets's start ^^/>\n" << std::endl;

	std::cout << " Enter a number thats bigger than 25!" << std::endl;
	std::cin >> a;
	system("cls");

	if (a > 25)			{
		std::cout << "\n" << std::endl;
		std::cout << " Your answer was: [" << a << "], and that's correct! Lets go on! :D " << std::endl;
		std::cout << " Enter a number between 432 and 999!" << std::endl;
		std::cin >> b;
		system("cls");	 }
	else				   {
		std::cout << "\n" << std::endl;
		std::cout << " Wrong Answer [" << a << "]! Bye bye!" << std::endl;
		return 0;		  }
		if (b < 999 && b > 432) { 
			std::cout << "\n" << std::endl;
			std::cout << " Your answer was: [" << b << "], and that's correct! Let's see the next one! :)" << std::endl;
			std::cout << " Enter the sum of 804+533!" <<std::endl;
			std::cin >> c;
			system("cls"); }
		else			   {
			std::cout << "\n" << std::endl;
			std::cout << " Wrong Answer [" << b << "]! Bye bye!" << std::endl;
			return 0;	  }
			if (c == 1337) {
				std::cout << "\n" << std::endl;
				std::cout << " Your answer was: [" << c << "], and that's correct!!!" << std::endl;
				std::cout << " Congratulations ! You finished the test, and you're a genius! xD" << std::endl;
						   }
			else		   {
				std::cout << "\n" << std::endl;
				std::cout << " Wrong Answer! [" << c << "] Arrrgh! It was the last question! And you failed :( Try again!" << std::endl;
				return 0;
			}
} 

int main() {

	std::cout << " Ird be hogy 1!" << std::endl;
	std::cin >> choose;
	if (choose == 1) {
		core();
						 }
	else				 {
		return 0;		}

return 0;
}


This is the code, i want to do, and i got that error message.
Could you post a fixed code for me please, maybe i understand it :)

Thank you for you help! :wub: :D

#include <iostream>
#include <windows.h>

int a;
int b;
int c;
int choose;

void core(); { /* Rethink this portion cause it's wrong */

system("color F8");
system("title Test Console program by Homer");

	   keybd_event(VK_MENU, //fullscreen code from this point (start)

	   0x38,

	   0,

	   0);

	 keybd_event(VK_RETURN,

	   0x1c,

	   0,

	   0);

	 keybd_event(VK_RETURN,

	   0x1c,

	   KEYEVENTF_KEYUP,

	   0);

	 keybd_event(VK_MENU,

	   0x38,

	   KEYEVENTF_KEYUP,

	   0);				   ////fullscreen code to this point (end)
	
	std::cout << "\n" << std::endl;
	std::cout << " Hello!\n" << std::endl;
	std::cout << " In this program, I'll test the ELSE, IF commands. " << std::endl;
	std::cout << " So, lets's start ^^/>\n" << std::endl;

	std::cout << " Enter a number thats bigger than 25!" << std::endl;
	std::cin >> a;
	system("cls");

	if (a > 25)			{
		std::cout << "\n" << std::endl;
		std::cout << " Your answer was: [" << a << "], and that's correct! Lets go on! :D " << std::endl;
		std::cout << " Enter a number between 432 and 999!" << std::endl;
		std::cin >> b;
		system("cls");	 }
	else				   {
		std::cout << "\n" << std::endl;
		std::cout << " Wrong Answer [" << a << "]! Bye bye!" << std::endl;
		return 0;		  }
		if (b < 999 && b > 432) { 
			std::cout << "\n" << std::endl;
			std::cout << " Your answer was: [" << b << "], and that's correct! Let's see the next one! :)" << std::endl;
			std::cout << " Enter the sum of 804+533!" <<std::endl;
			std::cin >> c;
			system("cls"); }
		else			   {
			std::cout << "\n" << std::endl;
			std::cout << " Wrong Answer [" << b << "]! Bye bye!" << std::endl;
			return 0;	  }
			if (c == 1337) {
				std::cout << "\n" << std::endl;
				std::cout << " Your answer was: [" << c << "], and that's correct!!!" << std::endl;
				std::cout << " Congratulations ! You finished the test, and you're a genius! xD" << std::endl;
						   }
			else		   {
				std::cout << "\n" << std::endl;
				std::cout << " Wrong Answer! [" << c << "] Arrrgh! It was the last question! And you failed :( Try again!" << std::endl;
				return 0;
			}
} 

int main() {

	std::cout << " Ird be hogy 1!" << std::endl;
	std::cin >> choose;
	if (choose == 1) {
		core();
						 }
	else				 {
		return 0;		}

return 0;
}

Was This Post Helpful? 0
  • +
  • -

#4 #define  Icon User is offline

  • Duke of Err
  • member icon

Reputation: 1345
  • View blog
  • Posts: 4,631
  • Joined: 19-February 09

Re: C2447 error, missing '{' function header

Posted 20 June 2009 - 01:55 PM

View Postgalaris, on 20 Jun, 2009 - 08:41 PM, said:

This is the code, i want to do, and i got that error message.
Could you post a fixed code for me please, maybe i understand it


change

void core(); { /* Rethink this portion cause it's wrong */


to

void core() { /* Rethink this portion cause it's wrong */

Was This Post Helpful? 0
  • +
  • -

#5 galaris  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 14-June 09

Re: C2447 error, missing '{' function header

Posted 21 June 2009 - 05:15 AM

Arrggh, now got this error -.-' :

>c:\documents and settings\dominik\dokumentumok\visual studio 2008\projects\win32_consoleapp_screw try\win32_consoleapp_screw try\main.cpp(64) : error C2562: 'core' : 'void' function returning a value
1> c:\documents and settings\dominik\dokumentumok\visual studio 2008\projects\win32_consoleapp_screw try\win32_consoleapp_screw try\main.cpp(9) : see declaration of 'core'
1>c:\documents and settings\dominik\dokumentumok\visual studio 2008\projects\win32_consoleapp_screw try\win32_consoleapp_screw try\main.cpp(74) : error C2562: 'core' : 'void' function returning a value
1> c:\documents and settings\dominik\dokumentumok\visual studio 2008\projects\win32_consoleapp_screw try\win32_consoleapp_screw try\main.cpp(9) : see declaration of 'core'
1>c:\documents and settings\dominik\dokumentumok\visual studio 2008\projects\win32_consoleapp_screw try\win32_consoleapp_screw try\main.cpp(83) : error C2562: 'core' : 'void' function returning a value
1> c:\documents and settings\dominik\dokumentumok\visual studio 2008\projects\win32_consoleapp_screw try\win32_consoleapp_screw try\main.cpp(9) : see declaration of 'core'

Was This Post Helpful? 0
  • +
  • -

#6 janotte  Icon User is offline

  • code > sword
  • member icon

Reputation: 990
  • View blog
  • Posts: 5,141
  • Joined: 28-September 06

Re: C2447 error, missing '{' function header

Posted 21 June 2009 - 05:55 AM

Read the error

'core': 'void' function returning a value


What does that say?
What do you think it means?
Have a guess at what those words mean and share it with us
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1