Vector2d.h:
#include <iostream>
using namespace std;
template <typename T, typename U>
class Vector2d
{
T x;
U y;
public:
Vector2d (T X, U Y)
{
x = X;
y = Y;
}
void printdata()
{
cout << "X: " << x << " Y: " << y;
}
};
main.cpp:
#include <iostream>
#include "Vector2d.h"
using namespace std;
template <typename a, typename b>
int main()
{
a Fnum;
b Snum;
cout << "Please enter two numbers ";
cin << Fnum;
cin << Snum;
Vector2d<a, b> TestVector (a Fnum, b Snum);
cout << TestVector.printdata();
return 0;
}
My problem is I am trying to make a 2D vector class (for game design) and I wanted to try working with templates. I will probably want to just use floating point numbers in the end, but I still want to learn how to use templates. When I run this program I get a:
unresolved external symbol main referenced in function __tmainCRTStartup
and I'm not sure what I'm doing wrong. If you need me to elaborate please feel free to ask.