Thread: what is wrong?

  1. #1
    "Why use dynamic memory?"
    Join Date
    Aug 2006
    Posts
    186

    what is wrong?

    I have a Human class that is derived publicly from a pure Player class.

    Player class includes <vector>
    Human class includes Player

    In the human class i define a function, which is not defined in Player class (this is just a function related to Human class alone... it has nothing to do with Player):
    Code:
    int  bet(vector<int>& availableBets, HINSTANCE hinstance);
    Code:
    int Human::bet(vector<int>& availableBets, HINSTANCE hinstance)
    {
    	//this function should pop up a modal dialog box
    	//so that the player can choose his bet
    
    	//get handles to all of the buttons to disable
    	//some if needed
    	
    	
    
    	_bet = (int)DialogBox(hinstance, //application instance
    	                  MAKEINTRESOURCE(IDD_ChooseBet), //style
    					  0, //parent
    					  (DLGPROC)ChooseBetProc //dialog procedure
    					  );
    }
    there is nothing wrong with the implementation but i got these error when compiling:

    error C2061: syntax error : identifier 'vector'
    error C2062: type 'int' unexpected
    error C2143: syntax error : missing ';' before '{'
    error C2447: '{' : missing function header (old-style formal list?)


    what is wrong?
    Last edited by Hussain Hani; 07-10-2009 at 01:00 AM.
    "C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg."-Bjarne Stroustrup
    Nearing the end of finishing my 2D card game! I have to work on its 'manifesto' though <_<

  2. #2
    C++11 User Tux0r's Avatar
    Join Date
    Nov 2008
    Location
    Sweden
    Posts
    135
    Try std::vector

  3. #3
    "Why use dynamic memory?"
    Join Date
    Aug 2006
    Posts
    186
    it worked!!!
    strange :S

    because in Player class, it has a function that takes a vector reference without an std!!

    thnx
    "C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg."-Bjarne Stroustrup
    Nearing the end of finishing my 2D card game! I have to work on its 'manifesto' though <_<

  4. #4
    C++11 User Tux0r's Avatar
    Join Date
    Nov 2008
    Location
    Sweden
    Posts
    135
    Perhaps you were "using namespace std;" in player.cpp but not in human.cpp, either way I like to always explicitly state std::

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 07-15-2004, 03:30 PM
  2. Debugging-Looking in the wrong places
    By JaWiB in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-03-2003, 10:50 PM
  3. Confused: What is wrong with void??
    By Machewy in forum C++ Programming
    Replies: 19
    Last Post: 04-15-2003, 12:40 PM
  4. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 12:01 PM
  5. Whats wrong?
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 07-14-2002, 01:04 PM