Help C++ Template function link error .# Programming - 葵花宝典
g*u
1 楼
Hi,
i am learning C++ template now. I decleared serveral template functions in a
head file and implemented them in a cpp file. In main function located in
mainfile I call these template functions, but everytime I tried, there was a
link error Lni 2001. When I move the declear and implementment to mainfile and
then call them, it's fine. In another way, I changed all the template
functions to normal functions in the head file and cpp file, the program works
well. So what's the problem?
Thanks
i am learning C++ template now. I decleared serveral template functions in a
head file and implemented them in a cpp file. In main function located in
mainfile I call these template functions, but everytime I tried, there was a
link error Lni 2001. When I move the declear and implementment to mainfile and
then call them, it's fine. In another way, I changed all the template
functions to normal functions in the head file and cpp file, the program works
well. So what's the problem?
Thanks