expected initializer before '&' token
Sep 22, 2016 at 4:24pm UTC
Hello,
I am getting the error "expected initializer before '&' token" after compiling the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#ifndef MAZE
#define MAZE
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <iomanip>
const int SIZE= 10;
class Maze
{
public :
void input (std::istream &in); //read in the maze
void output (std::ostream &out); //output the maze
protected :
char cells[SIZE][SIZE];
}
//#endif //MAZE_H
std::istream &operator >> (std::istream &in, Maze &m);
std::ostream &operator << (std::ostream &out, Maze m);
This is a header file to a class. I've seen similar problems on the web, but the solution has always been to put std:: in front of the istream. Please advise.
Sep 22, 2016 at 4:33pm UTC
You seem to be missing the required semicolon that completes the class definition.
Topic archived. No new replies allowed.