"Variable has initializer but incomplete type" - Help on this error?
Hi All,
When I compile my code I get the following error message:
Code:
test3.cpp:23: error: variable 'row row_chars' has initializer but incomplete type
I think it's due to the order of things - having to make main() at the top of the cpp file (a requirement for my assignment for "good programming").
I've put all the prototypes at the top, and above all of them I had to make a prototype of my class as well:
Code:
using namespace std;
class row;
void load_maze(list<row> &maze_rows, row &row_chars, const string &filein);
.. etc.
Then main():
Code:
int main (int argc, char *argv[])
{
string filein;
list<row> maze_rows;
row row_chars(1);
The last line there is where the error surfaces. When I create a new row object it takes an integer. I tried putting "int number" into the class prototype but that didn't help.
Any suggestions folks?