Source.cpp
#include <iostream>
#include <string>
#include <vector>
#include "Header.h"
using std::endl;
using std::cout;
using std::cin;
using std::string;
using std::vector;
void main() {
Test<float> testy(10, 100);
cout << testy.getTest1() << endl;
system("PAUSE");
}
Header.h
#pragma once
template<typename T>
class Test
{
private:
T test1, test2;
public:
Test(T a, T b);
~Test();
T getTest1();
T getTest2();
};
Header.cpp
#include "Header.h"
template<typename T>
Test<T>::Test(T a, T b)
{
test1 = a, test2 = b;
}
template<typename T>
Test<T>::~Test()
{
}
template<typename T>
T Test<T>::getTest1()
{
return test1;
}
template<typename T>
T Test<T>::getTest2()
{
return test2;
}
So I am lost, whenever I F5, I get error of this...
Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol "public: __thiscall Test::Test(float,float)" (??0?$Test@M@@QAE@MM@Z) referenced in function _main Tutorial Stuff C:\Users\a??\documents\visual studio 2015\Projects\Tutorial Stuff\Tutorial Stuff\Source.obj 1
Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol "public: __thiscall Test::~Test(void)" (??1?$Test@M@@QAE@XZ) referenced in function _main Tutorial Stuff C:\Users\a??\documents\visual studio 2015\Projects\Tutorial Stuff\Tutorial Stuff\Source.obj 1
Error LNK2019 unresolved external symbol "public: float __thiscall Test::getTest1(void)" (?getTest1@?$Test@M@@QAEMXZ) referenced in function _main Tutorial Stuff C:\Users\a??\documents\visual studio 2015\Projects\Tutorial Stuff\Tutorial Stuff\Source.obj 1
Error LNK1120 3 unresolved externals Tutorial Stuff C:\Users\a??\documents\visual studio 2015\Projects\Tutorial Stuff\Debug\Tutorial Stuff.exe 1
I'm assuming I'm not linking it right, from what the error is telling me, but I double double check how its done, don't know now what the problem is.