So I'm having this error and I'm pulling my hair out. I'm in Visual Studios 2013 and am getting this error:
Error 1 error LNK2019: unresolved external symbol "public: __thiscall testClass::testClass(int)" (??0?$testClass@H@@QAE@H@Z) referenced in function _main D:\Source Code\My Projects\test c++\test c++ project\ErrorTesting\ErrorTesting\test.obj ErrorTesting
file: testclass.h
template<typename t>
class testClass
{
public:
testClass(t test);
};
file: testclass.cpp
#include "testclass.h"
template<typename t>
testClass<t>::testClass(t test)
{
}
file:test.cpp
#include "testclass.h"
int main()
{
testClass<int> temp(1);
return 0;
}
Now I don't know why I can't call a non-default constructor with a template type but it compiles just fine if I call a default constructor.
Please note this is an example of the code that causes the error not my main project that I'm working on.