I get this error:
Error 1 error LNK2019: unresolved external symbol "public: __thiscall emath::VecN<float,3>::~VecN<float,3>(void)" (??1?$VecN@M$02@emath@@QAE@XZ) referenced in function _main C:\Users\RobertBerglund\documents\visual studio 2013\Projects\testEnv\testEnv\Source.obj testEnv
I don't know why, I declared the class destructor in the header emath.h:
template <typename T, const int n>
class VecN
{
public:
...
//destructor
~VecN();
...
};
And then I defined it in emath.cpp:
template <typename T, const int n>
VecN<T, n>::~VecN()
{
delete _data;
}
It is also maybe worth to mention that the declaration in the header is between:
namespace emath
{
...
}
And before the class definitions in the cpp file I have:
using namespace emath;
Also _data
is an array/pointer of type T
After the class declaration I define the folowing type to use in my code:
typedef VecN<float, 3> vec3;
In main() I have:
...
vec3 vec(4.0f);
...
cout << "vector test:";
for (int i = 0; i < 3; i++)
cout << vec[0] << vec[1] << vec[2] << endl;
...
Please let me know if I need to post more parts of my code, thanks in advance !