Thread: Dev-C++: Expecting ; where it shouldn't be

  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    14

    Dev-C++: Expecting ; where it shouldn't be

    So here I am working on a text game (Taking a break from Irrlicht) and one day this evil thing came into my room, the compiler error!

    So it says...
    FILENAME expected `;' before '(' token
    In my Player Object with all the functions, which are:
    Code:
    class Player
    {
          public:
                 void walkNorth();
                 void walkSouth();
                 void walkEast();
                 void walkWest();
                 void inspect();
                 void checkStats();
                 void levelUp();
                 int setAttack(attack_value);
                 int setDefense(defense_value);
                 int setSpeed(speed_value);
                 int setHealth(health_value);
                 int setMaxHealth(max_health_value);
                 int ammoSet(weapon,ammo_value);
                 int expSet(exp_gain);
          private:
                  int attack;
                  int defense;
                  int speed;
                  int health;
                  int mhealth;
                  int ammo[5];
                  int ammomax[5];
                  int exp;
                  int level;
    };

    The red snippets are what seem to be causing the problem, it repeats the compiler error for those lines, and I don't think it has to do with the actual function's data, but here you go.
    Code:
    int Player::setAttack(attack_value)
    {
         attack=attack_value;
    }
    
    int Player::setDefense(defense_value)
    {
         defense=defense_value;
    }
    
    int Player::setSpeed(speed_value)
    {
         speed=speed_value;
    }
    
    int Player::setHealth(health_value)
    {
         health=health_value;
    }
    
    int Player::setMaxHealth(max_health_value)
    {
         mhealth=max_health_value;
    }
    
    int Player::expAdd(exp_gain)
    {
        exp+=exp_gain;
    }
    
    int Player::ammoSet(weapon,ammo_value)
    {
        ammo[weapon]=ammo_value;
    }
    See, I don't know what I could POSSIBLY be doing wrong here, I am using Dev-C++ 4.9.9.2, and I HOPE I can stick with it. I am not entirely experienced in programming but I know a few good things on C++.

    Thanks in advance.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You need to specify the TYPE of the arguments to the functions.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Sep 2008
    Posts
    14
    HOLY- How the heck did I miss that? Well that was a waste...

    Thanks, I probably should've been looking closer at that.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by GlitchGuy2 View Post
    HOLY- How the heck did I miss that? Well that was a waste...

    Thanks, I probably should've been looking closer at that.
    Sure thing - but sometimes we just need SOMEONE ELSE to look at a line of code to spot what is wrong.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Whats better, C-Free or Dev C++??
    By i_can_do_this in forum Tech Board
    Replies: 10
    Last Post: 07-07-2006, 04:34 AM
  2. Why wont my function exit correctly?
    By LightsOut06 in forum C Programming
    Replies: 2
    Last Post: 10-09-2005, 09:23 PM
  3. New to Dev C++/<windows.h>...
    By Cilius in forum C++ Programming
    Replies: 3
    Last Post: 02-23-2005, 01:05 AM
  4. Glut and Dev C++, Programs not Quitting?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-29-2004, 08:43 PM
  5. Tutorial about Bloodshed Dev!
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 11-13-2001, 07:42 PM