Answer the question
In order to leave comments, you need to log in
Why does it throw an "unresolved external symbol" error when using class templates?
Good day!
I'm trying to use a template class:
#pragma once
#include <iostream>
#include <boost/asio/ip/tcp.hpp>
template <class T>
class TemplateClass {
public:
TemplateClass();
~TemplateClass();
};
#include "pch.h"
#include "TemplateClass.h"
template <class T>
TemplateClass<T>::TemplateClass() { }
template <class T>
TemplateClass<T>::~TemplateClass() { }
#include "pch.h"
#include <iostream>
#include "TemplateClass.h"
int main() {
TemplateClass<boost::asio::ip::tcp::socket>* test = new TemplateClass<boost::asio::ip::tcp::socket>();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question