Mayank
Mayank

Reputation: 1

ISO C++ forbids declaration Error

I am getting a very strange compile error pointing to where I declare a pointer to my class.

MyClass* myClass; //Line 34

Error:

MyFile.h|34|error: ISO C++ forbids declaration of ‘MyClass’ with no type
MyFilee.h|34|error: expected ‘;’ before ‘*’ token

I could not get a clue what is going wrong. Could anyone throw some light.

Upvotes: 0

Views: 355

Answers (1)

Kirill V. Lyadvinsky
Kirill V. Lyadvinsky

Reputation: 99535

Seems to be declaration of MyClass is not visible at that point. Compiler considers MyClass as a new variable's name without type specified.

Upvotes: 2

Related Questions