C ++ template definitions must be in header files - not external symbols LNK2019 link, LNK1120 unresolved external command

The compiler at the call of the template function, finally know how to generate the code.

Not as an ordinary member function declared as template functions defined in the header file in cpp source file, but must be defined in the header file.

If a statement like that and definitions ordinary member functions, a single file can compile, but it will be reported LNK2019, LNK1120 errors when using other files:

Guess you like

Origin www.cnblogs.com/dylanchu/p/12315493.html