Thread: error chaos

  1. #1
    lv.42 Berserker Drake's Avatar
    Join Date
    Jun 2005
    Posts
    67

    error chaos

    While trying to compile the driver method, my compiler presented me w/ MANY errors....all refering to the header file you see here. I would like to know if there is any thing i declared wrong in the include files and if my attack() function is declared right since one of the errors pointed to its line.

    -if i'm not being specific enough or you would like to see more code, just ask


    thanks



    Code:
    //#include "Weapon.h"
    #include<iostream>
    #include "Player.h"
    
    using namespace std; 
    
    class Enemy
    {
        public:
            void stats();
            void bStats();
            int attack(Enemy* enemyN, Player* playerN);
        private:
            int m_hp;
            int m_mp;
            int m_str;
            int m_exp;
            int m_level;
            string m_name;
    }
    //more code.....all of the functions are declared here...

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Well you could start with some error messages perhaps...
    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.

  3. #3
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Code:
    Enemy* enemyN, Player* playerN
    Where are these defined? Also, as Salem said, we can't do a whole lot without errors. We're not mind readers. Also, class definitions need to end in
    Code:
    };
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  4. #4
    For Narnia! Sentral's Avatar
    Join Date
    May 2005
    Location
    Narnia
    Posts
    719
    Quote Originally Posted by manutd
    Code:
    Enemy* enemyN, Player* playerN
    Where are these defined? Also, as Salem said, we can't do a whole lot without errors. We're not mind readers. Also, class definitions need to end in
    Code:
    };
    I'm guessing it's defined in his "player.h". Give us some errors!
    Videogame Memories!
    A site dedicated to keeping videogame memories alive!

    http://www.videogamememories.com/
    Share your experiences with us now!

    "We will game forever!"

  5. #5
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Compile the driver method? What?

  6. #6
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    missing a semicolon after the class declaration:
    Code:
    class CSomeClass
    {
        // Variables and stuff
    public:
        // Functions and stuff
    };    // Notice the semicolon.
    STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.

  7. #7
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Which is what I said
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  8. #8
    Registered User taelmx's Avatar
    Join Date
    Oct 2006
    Location
    Japan
    Posts
    55
    Problem solved?
    lol, yeah I was gonna say that you need a ";" after a class declaration.

  9. #9
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    >Compile the driver method? What?

    Bubba, I think he is refering to the main function as the driver, but as he not repsonded to any hints and tips we can rest assure he has solved the problem
    Double Helix STL

Popular pages Recent additions subscribe to a feed