I am making a C++ program using Microsoft Visual Studio 2010.
When I add comments in the header file I get error messages on part of my code that is not included in the comment. If I remove the first two lines of comments under public
, the errors under GameBoard(int p, int t)
go away. If I remover all four comments under public:
then the error under private:
goes away.
Here are the error messages that I get:
Under
GameBoard(int p, int t)
I get an error underint
that saysError: Expected an identifier.
I also get an error under the comma that saysError: Expected a ')'
And the last error I get is under the closing parenthesis that saysError: expected a ';'
. But these three errors go away as soon as I remove the first two commented lines of the code shown below.The other error I get is under
private:
, that says,Error: expected a declaration.
This error goes away as soon as I remove all four commented lines underpublic:
Does anyone know why this is happening, commented lines aren't supposed to have any effect on the code. I've tried using the other kind of comment /* */
but the same thing happens.
using namespace std;
#include <string>
#include "Tile.h"
#include <iostream>
class GameBoard{
public:
// p = The number of players
// t = The number of tiles each player will play with.
GameBoard(int p, int t);
void init();
// Scan the board and see if any tiles would be exiled.
void checkExile();
// Clear the board of any tiles.
void clear();
private:
// The Game Board.
TileO board[12][12];
// Detained tiles. The height is determined by the number of players. Each player can detain up to three tiles.
TileO * detained[3];
// These are the tiles that are not in the game.
// All tiles start on the bench, where the player places them on the Home Base.
TileO bench[4][2][4];
int players; // Number of players
int tilesPlaying; // Number of tiles
};