Thread: old style formal list???

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    6

    old style formal list???

    guys...what should i do if i have this error. i tried to search thru net but still couldn't solve it. This error making me crazy...i'm struck with it for few hours.

    Code:
     
    // Display the intro screen
    int introScreen(),STARTGAME;
    {	
    	DXUPlaySFX(RAVE);
    	while(DXUProcessMessages()) // Process system Messages
    	{	// read key board	
    		DXUReadKeyboard();
    		// if escape is pressed then game over
    		if (dxuKeyState[DIK_Q])
    			DXUDestroyWindow() ;
    		//	if space is pressed return start game
    		if (dxuKeyState[DIK_0])
    			return STARTGAME;
    		// Other wise draw the background 
    		DXURenderPrepare();
    		DXUDrawSpriteFast(&sprIntro);
    		strcpy(str,"");
    		DXUDrawText(&impactFont,str);
    		DXURenderFinish();
    	}
    	return GAMEOVER;
    }

  2. #2
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    Quote Originally Posted by brian2k
    This error making me crazy...i'm struck with it for few hours.
    Apparently not struck enough with it to actually show us what it is.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >int introScreen(),STARTGAME;
    Becomes:
    Code:
    int introScreen ( int STARTGAME )
    But that's assuming STARTGAME is an argument to the function and not just a typo.
    My best code is written with the delete key.

  4. #4
    Registered User
    Join Date
    Nov 2006
    Posts
    6
    you mean this?

    Background.cpp
    .\Background.cpp(273) : error C2447: '{' : missing function header (old-style formal list?)
    .\Background.cpp(296) : error C2447: '{' : missing function header (old-style formal list?)
    .\Background.cpp(317) : error C2447: '{' : missing function header (old-style formal list?)

    for the line 273, is wat i mean for the previous code

  5. #5
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    Quote Originally Posted by Prelude
    But that's assuming STARTGAME is an argument to the function and not just a typo.
    Your guess is as good as mine. I'm thinking it should be a global const int since it's being used as a return code.
    Code:
    const int STARTGAME = 1; //or anything really
    // Display the intro screen
    int introScreen()
    However, if that's the case, I'd suggest an enumeration of return codes since GAMEOVER is also being used that way.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  6. #6
    Registered User
    Join Date
    Nov 2006
    Posts
    6
    thanks guys although it doesnt help.

  7. #7
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    You generally have to give good information (preferably a lot of good information) in order to get the help you want. So if you would still like some help, please post detailed information about your problem. Don't be afraid to write too much.

  8. #8
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >thanks guys although it doesnt help.
    That's because we can't tell if you're trying to compile K&R C as C++, or just can't type. How about giving us more of a bone to chew on?
    My best code is written with the delete key.

  9. #9
    Registered User
    Join Date
    Nov 2006
    Posts
    6
    yeah...i should give more information. but i really sux in programmin. Actually i creating a 2D game using C++. Now i left 3 error from completing the game.

  10. #10
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >but i really sux in programmin.
    I find it confusing why people seem to think that lack of experience somehow justifies an inability to ask a smart question.

    >Actually i creating a 2D game using C++.
    Okay, not helpful.

    >Now i left 3 error from completing the game.
    You're on the home stretch. Still not helpful.

    >yeah...i should give more information.
    Yes. Start by posting each of the functions that are causing you problems. Then post how you declare those functions. Then post how you call those functions. That should be enough to tell the difference between old style C and fat finger syndrome.
    My best code is written with the delete key.

  11. #11
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    Yes, more information. Like where and how GAMEOVER is defined. I'm guessing that STARTGAME should be defined similarly.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  12. #12
    Registered User
    Join Date
    Nov 2006
    Posts
    6
    here is the code that have error.

    Code:
    // Display the intro screen
    int introScreen(),STARTGAME;
    {	
    	DXUPlaySFX(RAVE);
    	while(DXUProcessMessages()) // Process system Messages
    	{	// read key board	
    		DXUReadKeyboard();
    		// if escape is pressed then game over
    		if (dxuKeyState[DIK_Q])
    			DXUDestroyWindow() ;
    		//	if space is pressed return start game
    		if (dxuKeyState[DIK_0])
    			return STARTGAME;
    		// Other wise draw the background 
    		DXURenderPrepare();
    		DXUDrawSpriteFast(&sprIntro);
    		strcpy(str,"");
    		DXUDrawText(&impactFont,str);
    		DXURenderFinish();
    	}
    	return GAMEOVER;
    }
    
    void Introduction();
    int INTRODUCTION;
    {
    	while (DXUPrecessMessages())
    	{
    		DXUReadKeyboard();
    	if(dxuKeyState[DIK_Q])
    			DXUDestroyWindow();
    		if (dxuKeyState[DIK_1])
    			return INTRODUCTION;
    		
    		DXURenderPrepare();
    		DXUDrawSpriteFast(&sprIntro);
    		strcpy(str,""); 
    		DXUDrawText(&impactFont,str);
    		DXURenderFinish();
    	}
    	return GAMEOVER;
    }
    
    // Display the intro screen and the last score
    int interLevelScreen(int level);
    int strcpy;
    {	
    	while (DXUProcessMessages()) // Process system Messages
    	{	// read key board	
    		DXURenderPrepare();		
    		DXUDrawSpriteFast(&sprLevel);
    		strcpy(str,"");
    		rcImpact.top=220; 
    		DXUSetFontAttributes(&impactFont,&rcImpact,DT_LEFT|DT_WORDBREAK,DXURGB(0,0,255));
    		wsprintf(str,"LEVEL %-4d  Enemies:%-3d\n",level,currentTotalEnemies);
    		DXUDrawText(&impactFont,str);
    		DXURenderFinish();
    		Sleep(1000);
    		return 0;
    	}
    	return GAMEOVER;
    }

  13. #13
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Code:
    int interLevelScreen(int level);
    int strcpy;
    {
    Becomes:
    Code:
    int interLevelScreen(int level)
    {
    Code:
    void Introduction();
    int INTRODUCTION;
    {
    Becomes:
    Code:
    void Introduction()
    {
    Code:
    int introScreen(),STARTGAME;
    {
    Becomes:
    Code:
    int introScreen()
    {
    This is based on my assumptions, and knowing how you call the functions would make a big difference.
    My best code is written with the delete key.

  14. #14
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Maybe go back to the books and start with something simple like "hello world" before embarking on a sizeable program.

    There's also the "compile every 5 lines" so you find mistakes early. Writing hundreds of lines and dumping the whole mess on a message board is not the way to go.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  15. #15
    Registered User
    Join Date
    Nov 2006
    Posts
    6
    Thanks guys anyway. maybe i should learn from the start. Cheers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sorting linked list please help with CODE
    By scarlet00014 in forum C Programming
    Replies: 3
    Last Post: 09-27-2008, 11:24 PM
  2. Anyone good with linked list.....I am not....
    By chadsxe in forum C++ Programming
    Replies: 11
    Last Post: 11-10-2005, 02:48 PM
  3. Linked List
    By jpipitone in forum C Programming
    Replies: 4
    Last Post: 03-30-2003, 09:27 PM
  4. singly linked list
    By clarinetster in forum C Programming
    Replies: 2
    Last Post: 08-26-2001, 10:21 PM