C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 07-10-2009, 12:58 AM   #1
"Why use dynamic memory?"
 
Join Date: Aug 2006
Posts: 179
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?
__________________
"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
OS: Microsoft XP Media Center
IDE: Microsoft Visual Studio 2005 pro edition
Current Porject: Developing a 2D card game...

Last edited by Hussain Hani; 07-10-2009 at 01:00 AM.
Hussain Hani is offline   Reply With Quote
Old 07-10-2009, 01:03 AM   #2
C++0x User
 
Tux0r's Avatar
 
Join Date: Nov 2008
Location: Sweden
Posts: 133
Try std::vector
Tux0r is offline   Reply With Quote
Old 07-10-2009, 01:18 AM   #3
"Why use dynamic memory?"
 
Join Date: Aug 2006
Posts: 179
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
OS: Microsoft XP Media Center
IDE: Microsoft Visual Studio 2005 pro edition
Current Porject: Developing a 2D card game...
Hussain Hani is offline   Reply With Quote
Old 07-10-2009, 01:38 AM   #4
C++0x User
 
Tux0r's Avatar
 
Join Date: Nov 2008
Location: Sweden
Posts: 133
Perhaps you were "using namespace std;" in player.cpp but not in human.cpp, either way I like to always explicitly state std::
Tux0r is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with input choice... Somethings wrong... really wrong.... greenferoz C++ Programming 9 07-15-2004 03:30 PM
Debugging-Looking in the wrong places JaWiB A Brief History of Cprogramming.com 1 11-03-2003 10:50 PM
Confused: What is wrong with void?? Machewy C++ Programming 19 04-15-2003 12:40 PM
God datainjector A Brief History of Cprogramming.com 746 12-22-2002 12:01 PM
Whats wrong? Unregistered C Programming 6 07-14-2002 01:04 PM


All times are GMT -6. The time now is 06:08 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22