I've been interested in creating a math library for a project I'm working on, so I created a Math.h file with the namespace 'Math' and a 'Vector3' class defined in it. I'm now trying to define some math helper functions in the math namespace involving Vector3:
namespace Math {
Vector3 Test() {
return Vector3::Zero;
}
}
However, when I try including "Math.h" in my main.cpp, and try calling it
Vector3 test = Math::Test();
I get an error in Visual Studio 2019 saying
Severity Code Description Project File Line Suppression State
Error LNK2005 "class Vector3 __cdecl Math::Test(void)" (?Test@Math@@YA?AVVector3@@XZ) already defined in Math.obj myproject"
and I'm not sure if there is something I need to do use a class I made inside of a namespace?