Ask a problem,about template:)
i write template class
<<<<<<<<<class.h>>>>>>>>
#pragma once
template <class T> class Tem
{
public:
T rxg(T a);
};
<<<<<<<<<class.Cpp>>>>>>>>
#include "stdafx.h"
#include "class.h"
template<class T>T Tem<T>::rxg(T a)
{
return a;
}

<<<<<<<<<<<Dialog.Cpp>>>>>>>>>
#include "Class.h"
................................
Tem<int> moral;
int a=moral.rxg(10);

Error:
Test.obj : error LNK2019: unresolved external symbol "public: int __thiscall Tem<int>::rxg(int)" ([EMAIL="?rxg@?$Tem@H@@QAEHH@Z"]?rxg@?$Tem@H@@QAEHH@Z[/EMAIL]) referenced in function "public: void __thiscall CAboutDlg::OnBnClickedOk(void)" ([EMAIL="?OnBnClickedOk@CAboutDlg@@QAEXXZ"]?OnBnClickedOk@CAboutDlg@@QAEXXZ[/EMAIL])
thank:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.