undefined reference to template function [duplicate]
问题 This question already has answers here : “Undefined reference to” template class constructor [duplicate] (3 answers) Closed 2 years ago . I have three files . The contents of main.cpp are #include<iostream> #include<QString> #include "util.h" int main() { using Util::convert2QString; using namespace std; int n =22; QString tmp = convert2QString<int>(n); return 0; } util.h namespace Util { template<class T> QString convert2QString(T type , int digits=0); } util.cpp namespace Util { template