-
Class not recognized
When ever I write a class on one file, and try to use it on an other file, I get errors like 'error C2065: 'MyClass' : undeclared identifier'.
I learnt that only if the class declaration appears in the same file, and before the line it is used, only then my project will compile.
I'm pretty sure theres something simple that I'm doing wrong... How do I solve this?
-
You have to #include the header file where you defined the class.
If you didn't define the class in a header, then you need to do that and include the header in the source files that use that class.
-
Thank you for your quick reply
-
I think buddy u r writing your class in your .cc/.cpp file and then try to use it there or your are writing your class in your header file and then try to use it
just declare your calss in a header file and include it where ever you want