I keep getting Error LNK2019: unresolved external symbol. Could someone please look at my code, and tell me what I am doing wrong...
Using VS 2013
File main.cpp:
#include <iostream>
#include "Vector2.hpp"
int main() {
RB::Vector2i _Vec2();
int _Input;
_Input = std::getchar();
return 0;
}
File Vector2.hpp:
#pragma once
namespace RB {
template<typename T>
struct Vector2 {
T X;
T Y;
// Constructor
Vector2(void);
Vector2(const T& _X, const T& _Y);
};
// Declare Different Template Types
typedef Vector2<int> Vector2i;
typedef Vector2<unsigned int> Vector2u;
typedef Vector2<float> Vector2f;
}
File Vector2.cpp:
#include "Vector2.hpp"
namespace RB {
// Constructor
template<typename T>
Vector2<T>::Vector2(void) {
X = 0;
Y = 0;
}
template<typename T>
Vector2<T>::Vector2(const T& _X, const T& _Y) {
X = _X;
Y = _Y;
}
}
ErrorCode:
Error 1 error LNK2019: unresolved external symbol "public: __thiscall RB::Vector2<int>::Vector2<int>(int const &,int const &)" (??0?$Vector2@H@RB@@QAE@ABH0@Z) referenced in function _main
Last edited on
Solved... I decided to make the Vector2.cpp file, inline...