I have this and I can't seem to include the namespace correctly.
main.cpp
#include <iostream>
int main()
{
my_space::Print(); // main.cpp:5:5: error: use of undeclared identifier 'my_space'
return 0;
}
otherclass.cpp
#include <iostream>
namespace my_space {
int x, y;
void Print()
{
std::cout << "Hello from namespace my_space." << std::endl;
}
}
I have tried adding a otherclass.h with namespace my_space {}; in it and in main.cpp include #include "otherclass.h" but this didn't worked either.