I am writing a text-based minesweeper. My idea is to implement the grid using vector of a vector, to get the two-dimensional indexing to work. The header looks like:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
class Grid
{
private:
int width;
int height;
int TotalMine; // total number of mines
vector < vector<int> > mine; // mine distribution and number
// -1 if mine, otherwise number
// of neighboring mines
...
|
I am using Code:Blocks with mingw on 64-bit Win7. Now, strangely enough, when I compile the entire project, the compiler always returns
|
error: ISO c++ forbids declaration of 'vector' with no type
|
for that line with vector declaration.
I wrote a separate test program, to which I
1) copy-pasted this part of the code;
2) added a constructor which set all elements to zero and a getter for the elements;
3) had the main() to just call the constructor and then print a couple of the elements.
And it compiled with no error!
Comments and suggestions, please? I am nearly frustrated enough to smash my laptop now. Guess I should walk away and have a glass of water...