C++ - LNK2019 error unresolved external symbol [template class's constructor and destructor] referenced in function _main
Why don't you follow the "Inclusion Model"? I'd recommend you follow that model. The compiler needs to have access to the entire template definition (not just the signature) in order to generate code for each instantiation of the template, so you need to move the definitions of the functions to your header.
Note: In general most C++ compilers do not easily support the separate compilation model for templates.
Furthermore you need to read this.
An example for solving the error lnk2019:
It has to write #include "EXAMPLE.cpp" at the end of .h file
//header file codes
#pragma once
#ifndef EXAMPLE_H
#define EXAMPLE_H
template <class T>
class EXAMPLE
{
//class members
void Fnuction1();
};
//write this
#include "EXAMPLE.cpp"
#endif
//----------------------------------------------
In the .cpp file do as following
//precompile header
#include "stdafx.h"
#pragma once
#ifndef _EXAMPLE_CPP_
#define _EXAMPLE_CPP_
template <class T>
void EXAMPLE<T>::Fnuction1()
{
//codes
}
#endif
//-----------------------------------------------
All template code need to be accessible during compilation. Move the Queue.cpp implementation details into the header so that they are available.