CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    Join Date
    Apr 2010
    Posts
    18

    Question Small error need help!

    I am using visual c++ 2010. I need help with a small error!

    Error:
    [code1]> Run.cpp
    1>Run.cpp(16): error C2447: '{' : missing function header (old-style formal list?)
    1>Run.cpp(122): fatal error C1004: unexpected end-of-file found
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========[/code]

    I don't understand it much. I am new to c++ I don't have much of a clue what I am doing. xP So yah.. how can I fix this?

  2. #2
    Join Date
    Apr 2010
    Posts
    18

    Re: Small error need help!

    Error:
    Code:
    > Run.cpp
    1>Run.cpp(16): error C2447: '{' : missing function header (old-style formal list?)
    1>Run.cpp(122): fatal error C1004: unexpected end-of-file found
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    Reposted the error sorry for double posting but it won't let me edit my posts. xD

  3. #3
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Small error need help!

    Without seeing the code that's responsible for the error it's hard to say what's going on.

  4. #4
    Join Date
    Apr 2010
    Posts
    18

    Re: Small error need help!

    Oh sorry here like I said I am new. :P I am trying to make a mmorpg out of c++ my friend did..

    Code:
     int server () {
      cout << "Server Online!";
      return 0;
    } {
    	static Combat() {  // Combat
    	   int lifepoints ();
           int attack ();
    	   int power ();
           int defense ();
           int magic ();
    	   int archery ();
    	} {
    	static Skills () { // Skills
    	int woodcutting ();
    	int firemaking ();
    	int fishing ();
    	int cooking ();
    	int theft ();
    	int endurance ();
    	int riding ();
    	int sailing ();
    	int construct ();
     } {
    	static mount classes () { // Mounts
    	 int birds ();
    	 int dragovians ();
    	 int reptillian ();
    	 int fish ();
    	} {
    	public void level () { // Levels
    		// Combat
    		int running (100&#37;);
    		int combat level (5);
    		int lifepoints level (5);
    		int attack level (0);
    		int power level (0); 
    		int defense level (0);
    		int magic level (0);
    		int archery level (0);
    		// Skills
    		int woodcutting level (0);
    		int firemaking level (0);
    		int fishing level (0);
    		int cooking level (0);
    		int theft level (0);
    		int endurance level (0);
    		int riding level (0);
    		int sailing level (0);
    		int construct level (0);
    	}
    	public void MaxCombat () { // Max Combat Level
    		static int (140);
    	}
    	public void MaxLevel () { // Max Levels
    		static int (100);
    	}
        public void woodcutting () { // Woodcutting 
                if (misc.random(treechance) != 0) return;
                final int treeID = treetype;
                final int Treetimer = treetimer;
                int stumpID = 1341;
                final int X = treeX;
                final int Y = treeY;
    
                for (int i = 0; i < server.playerHandler.maxPlayers; i++) {
                    if (server.playerHandler.players[i] != null) {
                        client c = (client) server.playerHandler.players[i];
                        c.createobject(stumpID, X, Y, 0, -2, 10);
                        if (c.chopping) {
                            c.frame1();
                            if (c.treeX == X && c.treeY == Y) {
                                chopping = false;
                            }
                        }
                    }
                }
                EventManager.getSingleton().addEvent(
                        new Event() {
                            public void execute(EventContainer C) {
                                for (int i = 0; i < server.playerHandler.maxPlayers; i++) {
                                    if (server.playerHandler.players[i] != null) {
                                        client c = (client) server.playerHandler.players[i];
                                        c.createobject(treeID, X, Y, 0, -2, 10);
                                    }
                                }
                                C.stop(); // stops the event from running
                            }
                        }, Treetimer * 600);
            }
    	if (choptimer > 0) {
                    choptimer--;
                }
    
                if (chopping && freeSlots() <= 0) {
                    chopping = false;
                    cout << "Your inventory is full";
                }
    
                if (chopping && choptimer <= 0) {
                    addSkillXP(chopXP, 8);
                    addItem(logID, 1);
                    cout << "You chop some"; + getItemName(logID).toLowerCase());
                    choptimer = misc.random(calcchop(logID));
                    treefall();
                }
    
                if (chopping) {
                    setAnimation(wcemote);
                }
    Thanks

  5. #5
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Small error need help!

    There's a lot of wierd stuff going on here..
    Code:
      return 0;
    } {
    Code:
    static Combat()
     {  // Combat
     int lifepoints ();
    Is this a mistake or deliberate?
    Last edited by S_M_A; April 17th, 2010 at 05:29 PM.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  6. #6
    Join Date
    Apr 2010
    Posts
    18

    Re: Small error need help!

    I don't know what you mean I said I am new to this. How do I fix it all? I said I am trying to make a mmorpg from c++.. xP How do I fix it? I don't understand what you mean by posting the same codes I have on it O_o

  7. #7
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Small error need help!

    I said I am trying to make a mmorpg from c++
    Say what ? You are trying to make mmorpg and you don't have a clue about C++ ?

    Here's a tip. Start learning C++. By the time you understand the basics, you can start working on learning how to program. After that, try to make a simple tetris clone to find out that you are one half there.

  8. #8
    Join Date
    Apr 2010
    Posts
    18

    Re: Small error need help!

    What is wrong with making a mmorpg while learning c++ at the same time? xP Please stop being offtopic I really need help

  9. #9
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Small error need help!

    Quote Originally Posted by Mod Hidden View Post
    What is wrong with making a mmorpg while learning c++ at the same time?
    Understanding the basics of a mmorpg takes you 2 years of experience. Actually help building one roughly 5 years. I'm not trying to make phun of you, but you are going at it the wrong way. S_M_A showed you where the errors come from... google for how functions are defined.

  10. #10
    Join Date
    Apr 2010
    Posts
    18

    Re: Small error need help!

    You mean them little red things in his [code] I removed them but got stuck... >_<

    When I remove

    Code:
     #include "stdafx.h"
    #include <iostream>
    #include <intrin.h>
    
    using namespace std;
    
    int server () {
      cout << "Server Online!";
      return 0;
    }
    	void static Combat() {  // Combat
    	  static int lifepoints;
          static int attack;
    	  static int power;
          static int defense;
          static int magic;
    	  static int archery;
    	} 
    	void static Skills () { // Skills
    	static int woodcutting;
    	static int firemaking;
    	static int fishing;
    	static int cooking;
    	static int theft;
    	static int endurance;
    	static int riding;
    	static int sailing;
    	static int construct;
    	} 
    	void static mount () { // Mounts
    	static int birds;
    	static int dragovians;
    	static int reptillian;
    	static int fish;
    	} {
    	public void level () { // Levels
    		// Combat
    		int running (100%);
    		int combat level (5);
    		int lifepoints level (5);
    		int attack level (0);
    		int power level (0); 
    		int defense level (0);
    		int magic level (0);
    		int archery level (0);
    		// Skills
    		int woodcutting level (0);
    		int firemaking level (0);
    		int fishing level (0);
    		int cooking level (0);
    		int theft level (0);
    		int endurance level (0);
    		int riding level (0);
    		int sailing level (0);
    		int construct level (0);
    	} 
    	public void MaxCombat () { // Max Combat Level
    		static int (140);
    	}
    	public void MaxLevel () { // Max Levels
    		static int (100);
    	}
        public void woodcutting () { // Woodcutting 
                if (misc.random(treechance) != 0) return;
                final int treeID = treetype;
                final int Treetimer = treetimer;
                int stumpID = 1341;
                final int X = treeX;
                final int Y = treeY;
    
                for (int i = 0; i < server.playerHandler.maxPlayers; i++) {
                    if (server.playerHandler.players[i] != null) {
                        client c = (client) server.playerHandler.players[i];
                        c.createobject(stumpID, X, Y, 0, -2, 10);
                        if (c.chopping) {
                            c.frame1();
                            if (c.treeX == X && c.treeY == Y) {
                                chopping = false;
                            }
                        }
                    }
                }
                EventManager.getSingleton().addEvent(
                        new Event() {
                            public void execute(EventContainer C) {
                                for (int i = 0; i < server.playerHandler.maxPlayers; i++) {
                                    if (server.playerHandler.players[i] != null) {
                                        client c = (client) server.playerHandler.players[i];
                                        c.createobject(treeID, X, Y, 0, -2, 10);
                                    }
                                }
                                C.stop(); // stops the event from running
                            }
                        }, Treetimer * 600);
            }
    	if (choptimer > 0) {
                    choptimer--;
                }
    
                if (chopping && freeSlots() <= 0) {
                    chopping = false;
                    cout << "Your inventory is full";
                }
    
                if (chopping && choptimer <= 0) {
                    addSkillXP(chopXP, 8);
                    addItem(logID, 1);
                    cout << "You chop some"; + getItemName(logID).toLowerCase());
                    choptimer = misc.random(calcchop(logID));
                    treefall();
                }
    
                if (chopping) {
                    setAnimation(wcemote);
                }
    In red I put in my code

    I get this error now..

    Code:
     1>  Run.cpp
    1>Run.cpp(42): error C2059: syntax error : 'public'
    1>Run.cpp(42): error C2143: syntax error : missing ';' before '{'
    1>Run.cpp(42): error C2447: '{' : missing function header (old-style formal list?)
    1>Run.cpp(63): error C2059: syntax error : 'public'
    1>Run.cpp(63): error C2143: syntax error : missing ';' before '{'
    1>Run.cpp(63): error C2447: '{' : missing function header (old-style formal list?)
    1>Run.cpp(66): error C2059: syntax error : 'public'
    1>Run.cpp(66): error C2143: syntax error : missing ';' before '{'
    1>Run.cpp(66): error C2447: '{' : missing function header (old-style formal list?)
    1>Run.cpp(69): error C2059: syntax error : 'public'
    1>Run.cpp(69): error C2143: syntax error : missing ';' before '{'
    1>Run.cpp(69): error C2447: '{' : missing function header (old-style formal list?)
    1>Run.cpp(102): error C2059: syntax error : 'if'
    1>Run.cpp(102): error C2143: syntax error : missing ';' before '{'
    1>Run.cpp(102): error C2447: '{' : missing function header (old-style formal list?)
    1>Run.cpp(106): error C2059: syntax error : 'if'
    1>Run.cpp(106): error C2143: syntax error : missing ';' before '{'
    1>Run.cpp(106): error C2447: '{' : missing function header (old-style formal list?)
    1>Run.cpp(111): error C2059: syntax error : 'if'
    1>Run.cpp(111): error C2143: syntax error : missing ';' before '{'
    1>Run.cpp(111): error C2447: '{' : missing function header (old-style formal list?)
    1>Run.cpp(119): error C2059: syntax error : 'if'
    1>Run.cpp(119): error C2143: syntax error : missing ';' before '{'
    1>Run.cpp(119): error C2447: '{' : missing function header (old-style formal list?)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    What do I do now?

  11. #11
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Small error need help!

    I thought that pointing out some of the weird things in the previous listing would lead to that the OP put some effort in making it all correct but the last listing prove me wrong... I totally agree with Skizmo here, there's so many basic error's here that you really should start learning C++ before taking any other task.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  12. #12
    Join Date
    Apr 2010
    Posts
    18

    Re: Small error need help!

    Well I really want to do it while I am learning. If I don't in the future I will forget everything I wanted for my mmorpg. xD I already have everything laid out and if I stop now just to learn C++ I won't do it in the future then it will all end up pretty much meaningless Can you guys please help me with these errors? Do I need to find another support c++ forum? Because I don't like wasting my time.

  13. #13
    Join Date
    Aug 2008
    Posts
    902

    Re: Small error need help!

    Quote Originally Posted by Mod Hidden View Post
    Well I really want to do it while I am learning. If I don't in the future I will forget everything I wanted for my mmorpg. xD I already have everything laid out and if I stop now just to learn C++ I won't do it in the future then it will all end up pretty much meaningless Can you guys please help me with these errors? Do I need to find another support c++ forum? Because I don't like wasting my time.
    This is what you call running before you learn to walk. Your syntax is totally off. You'd be better off getting a few "Hello, World" programs to compile before you try a MMO (which is an incredibly difficult undertaking regardless of your C++ knowledge)

  14. #14
    Join Date
    Apr 2010
    Posts
    18

    Re: Small error need help!

    Thanks guys for ruining my dreams. You wasted alot of my time. All I asked was help to fix a few errors instead you spam my thread with stuff that tell me, "give up you'll never make one ever." thanks your all so helpful.

    [edit]

    Finally can edit. :P

    Please email me when you guys start giving actual help thanks
    Last edited by Mod Hidden; April 17th, 2010 at 07:57 PM.

  15. #15
    Join Date
    Aug 2008
    Posts
    902

    Re: Small error need help!

    Quote Originally Posted by Mod Hidden View Post
    Thanks guys for ruining my dreams. You wasted alot of my time. All I asked was help to fix a few errors instead you spam my thread with stuff that tell me, "give up you'll never make one ever." thanks your all so helpful.

    [edit]

    Finally can edit. :P

    Please email me when you guys start giving actual help thanks
    This isn't a "few errors." There's really no option but to re-write this thing from scratch, using C++, because that certainly wasn't what you wrote this in. Nobody said you couldn't do this, but as it stands now, you do not have a program that is written in C++, or C, or Java, or any other language I've seen before.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured