ms vs c++ shows error where it shouldn't

Hello, I've got problem with Microsoft Visual Studio C++ 2008 Express Edition, I declared a variable in one of my class and allocated memory for it like:
1
2
Manager* manager; // where the error occurs
manager = new Manager();

VS shows that it's an error:
error C2143: syntax error : missing ';' before '*'

but then I delete the first line and compile, write it again, it compiles and runs fine, however later the same thing happens and I need to do all again, delete, compile, write, compile. Can anybody help with this? Thanks.

EDIT: It also throws an error without the second line, Manager class is included and compiler recognizes it, can't imagine whats wrong :(
Last edited on
Sounds like Manager is not declared, so you should make sure the declaration is visible at that point.
And if it compiles without the first line, your code might have some other problems too...
Yes, the declaration is visible to the second line and the error occurs on the first line, Manager is declared. No it doesn't compile without the first line, sorry I forgot to mention it. I've notice that using everything in one line like this:
Manager *manager = new Manager();

works, but I need the manager to be in my class scope, not in the method where I declare it.
Well, you probably have a circular include somewhere (e.g.: manager.hpp includes x.hpp and x.hpp includes manager.hpp).
If you can't resolve that, you can still add a forward declaration for the Manager class.
Oh, thank you very much! :) I had a circular include, my core.h includes manager.h, it includes setup.h and setup.h includes core.h, I've simply added this line:
class Manager;

before the class declaration where this line is:
Manager *manager;
Topic archived. No new replies allowed.