Here is my code http://rafb.net/p/noi06840.html

Now I will paste a list of errors that I keep getting, Any help appreciated

1>c:\users\vypr\documents\project0809\Board2.h(19) : error C2061: syntax error : identifier 'boolean'
1>c:\users\vypr\documents\project0809\Board2.h(28) : error C2079: 'RandomPlayer::moves' uses undefined class 'MoveList'
1>c:\users\vypr\documents\project0809\Board2.h(29) : error C2079: 'RandomPlayer::cm' uses undefined class 'CheckerMove'
1>c:\users\vypr\documents\project0809\Board2.h(33) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\vypr\documents\project0809\Board2.h(33) : warning C4183: 'randomPlayer': missing return type; assumed to be a member function returning 'int'
1>c:\users\vypr\documents\project0809\Board2.h(34) : error C2061: syntax error : identifier 'boolean'
1>c:\users\vypr\documents\project0809\Board2.h(47) : error C2146: syntax error : missing ';' before identifier 'moves'
1>c:\users\vypr\documents\project0809\Board2.h(47) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\vypr\documents\project0809\Board2.h(47) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\vypr\documents\project0809\Board2.h(65) : error C2146: syntax error : missing ';' before identifier 'moves'
1>c:\users\vypr\documents\project0809\Board2.h(65) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\vypr\documents\project0809\Board2.h(65) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\vypr\documents\project0809\Board2.h(78) : error C2504: 'BackGammonPlayer' : base class undefined
1>c:\users\vypr\documents\project0809\Board2.h(80) : error C2079: 'HumanPlayer::cm' uses undefined class 'CheckerMove'
1>c:\users\vypr\documents\project0809\Board2.h(84) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\vypr\documents\project0809\Board2.h(84) : warning C4183: 'humanPlayer': missing return type; assumed to be a member function returning 'int'
1>c:\users\vypr\documents\project0809\Board2.h(85) : error C2061: syntax error : identifier 'String'
1>c:\users\vypr\documents\project0809\Board2.h(86) : error C2061: syntax error : identifier 'boolean'
1>c:\users\vypr\documents\project0809\Board2.h(91) : error C2079: 'BG::game' uses undefined class 'BackgammonGame'
1>c:\users\vypr\documents\project0809\Board2.h(92) : error C2259: 'BackgammonPlayer' : cannot instantiate abstract class
1> due to following members:
1> 'CheckerMove BackgammonPlayer::chooseMove(board2,int *)' : is abstract
1> c:\users\vypr\documents\project0809\Board2.h(19) : see declaration of 'BackgammonPlayer::chooseMove'
1>c:\users\vypr\documents\project0809\Board2.h(93) : error C2259: 'BackgammonPlayer' : cannot instantiate abstract class
1> due to following members:
1> 'CheckerMove BackgammonPlayer::chooseMove(board2,int *)' : is abstract
1> c:\users\vypr\documents\project0809\Board2.h(19) : see declaration of 'BackgammonPlayer::chooseMove'
1>c:\users\vypr\documents\project0809\Board2.h(97) : error C2259: 'BackgammonPlayer' : cannot instantiate abstract class
1> due to following members:
1> 'CheckerMove BackgammonPlayer::chooseMove(board2,int *)' : is abstract
1> c:\users\vypr\documents\project0809\Board2.h(19) : see declaration of 'BackgammonPlayer::chooseMove'
1>c:\users\vypr\documents\project0809\Board2.h(97) : error C2259: 'BackgammonPlayer' : cannot instantiate abstract class
1> due to following members:
1> 'CheckerMove BackgammonPlayer::chooseMove(board2,int *)' : is abstract
1> c:\users\vypr\documents\project0809\Board2.h(19) : see declaration of 'BackgammonPlayer::chooseMove'
1>c:\users\vypr\documents\project0809\Board2.h(98) : error C2259: 'BackgammonPlayer' : cannot instantiate abstract class
1> due to following members:
1> 'CheckerMove BackgammonPlayer::chooseMove(board2,int *)' : is abstract
1> c:\users\vypr\documents\project0809\Board2.h(19) : see declaration of 'BackgammonPlayer::chooseMove'
1>c:\users\vypr\documents\project0809\Board2.h(98) : error C2259: 'BackgammonPlayer' : cannot instantiate abstract class
1> due to following members:
1> 'CheckerMove BackgammonPlayer::chooseMove(board2,int *)' : is abstract
1> c:\users\vypr\documents\project0809\Board2.h(19) : see declaration of 'BackgammonPlayer::chooseMove'
1>c:\users\vypr\documents\project0809\Board2.h(107) : error C2259: 'BackgammonPlayer' : cannot instantiate abstract class
1> due to following members:
1> 'CheckerMove BackgammonPlayer::chooseMove(board2,int *)' : is abstract
1> c:\users\vypr\documents\project0809\Board2.h(19) : see declaration of 'BackgammonPlayer::chooseMove'
1>c:\users\vypr\documents\project0809\Board2.h(108) : error C2259: 'BackgammonPlayer' : cannot instantiate abstract class
1> due to following members:
1> 'CheckerMove BackgammonPlayer::chooseMove(board2,int *)' : is abstract
1> c:\users\vypr\documents\project0809\Board2.h(19) : see declaration of 'BackgammonPlayer::chooseMove'
1>c:\users\vypr\documents\project0809\Board2.h(109) : error C2079: 'BackgammonGame::board' uses undefined class 'board2'
1>c:\users\vypr\documents\project0809\Board2.h(110) : error C2146: syntax error : missing ';' before identifier 'd1'
1>c:\users\vypr\documents\project0809\Board2.h(110) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\vypr\documents\project0809\Board2.h(110) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\vypr\documents\project0809\Board2.h(111) : error C2146: syntax error : missing ';' before identifier 'd2'
1>c:\users\vypr\documents\project0809\Board2.h(111) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\vypr\documents\project0809\Board2.h(111) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\vypr\documents\project0809\Board2.h(114) : error C2259: 'BackgammonPlayer' : cannot instantiate abstract class
1> due to following members:
1> 'CheckerMove BackgammonPlayer::chooseMove(board2,int *)' : is abstract
1> c:\users\vypr\documents\project0809\Board2.h(19) : see declaration of 'BackgammonPlayer::chooseMove'
1>c:\users\vypr\documents\project0809\Board2.h(114) : error C2259: 'BackgammonPlayer' : cannot instantiate abstract class
1> due to following members:
1> 'CheckerMove BackgammonPlayer::chooseMove(board2,int *)' : is abstract
1> c:\users\vypr\documents\project0809\Board2.h(19) : see declaration of 'BackgammonPlayer::chooseMove'
1>c:\users\vypr\documents\project0809\Board2.h(115) : error C2146: syntax error : missing ';' before identifier 'playMatches'
1>c:\users\vypr\documents\project0809\Board2.h(115) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\vypr\documents\project0809\Board2.h(115) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\vypr\documents\project0809\Board2.h(115) : warning C4183: 'playMatches': missing return type; assumed to be a member function returning 'int'
1>c:\users\vypr\documents\project0809\Board2.h(122) : error C2146: syntax error : missing ';' before identifier 'r'

Recommended Answers

All 2 Replies

Just declaring your classes before they are used isn't always sufficient. E.g you declare

class MoveList;

before it is used in

class RandomPlayer : public BackgammonPlayer

but in this case you actually need the complete class definition of MoveList before the definition of RandomPlayer.
If you were using a pointer to MoveList in RandomPlayer you would be able to get away with it because the pointer size is known.

So you need to do a bit of re-ordering in the header file. You may find it easier if you put each class in a separate header file and only include the ones you need.

Also, use bool instead of boolean.

I'm sure there will be several problems after those are sorted. Hard to see the wood for the trees at the moment!

>>1>c:\users\vypr\documents\project0809\Board2.h(19) : error C2061: syntax error : identifier 'boolean'

There is no such keyword as boolean -- its bool

[edit]what ^^^ he said too :) [/edit]

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.