Hi everyone, I need a little hand with declaring a string array in my C ++ class header file.
atm looks like this:
#include <string>
class Maze
{
GLfloat mazeSize, mazeX, mazeY, mazeZ;
string* mazeLayout;
public:
Maze ( );
void render();
};
and the constructor looks like this:
#include <GL/gl.h>
#include "Maze.h"
#include <iostream>
#include <fstream>
Maze::Maze( )
{
cin >> mazeSize;
mazeLayout = new string[mazeSize];
mazeX = 2/mazeSize;
mazeY = 0.25;
mazeZ = 2/mazeSize;
}
I get a compiler error message:
In file included from model-view.cpp:11:
Maze.h:14: error: ISO C++ forbids declaration of ‘string’ with no type
Maze.h:14: error: expected ‘;’ before ‘*’ token
and the only meaning that makes for me is that for some reason it thinks that I want the string to be a variable name not as a type declaration.
If someone could help me, it would be fantastic, looked at it for a while, and it gave me shats lol.
Greetings guys
source
share