In C#, I got use to putting each class into its own file. During compilation, it would link all these files together and make a final executable program. While going back to C++, I've been trying to achieve the same process. My files include...
winmain.cpp // obvious main start of the program
winmain.h // header
Common.cpp // my character's class
In Common.cpp, the simple file contains the following:
Code:
#include <iostream>
namespace MyNamespace
{
class Common
{
public:
int x, y;
};
}
I create the Common object named PC in my winmain.cpp file like this:
MyNamespace::Common PC;
I try compiling the project now. I recieve the following errors:
error C2653: 'MyNamespace' : is not a class or namespace name
error C2065: 'Common' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'PC'
error C2065: 'PC' : undeclared identifier
What am I missing here?