Hi, i have a problem with compiling these file:


Qt Code:
  1. /** @file struct.h */
  2.  
  3. #ifndef STRUCT_H
  4. #define STRUCT_H
  5.  
  6. using namespace std;
  7.  
  8. ...
  9.  
  10. template <typename cStruct> int InitLine(cStruct * toStruct);
  11. template <typename cStruct, typename cItem> int AddToLine(cStruct * toStruct, cItem * newItem);
  12. template <typename cStruct, typename cItem> int DeleteFromLine(cStruct * toStruct, cItem * delItem);
  13.  
  14. #endif // STRUCT_H
To copy to clipboard, switch view to plain text mode 


Qt Code:
  1. /** @file struct.cpp */
  2.  
  3. #include "struct.h"
  4.  
  5. template <typename cStruct> int InitLine(cStruct * toStruct)
  6. {
  7. toStruct->first=NULL;
  8. toStruct->last=NULL;
  9. toStruct->top=0;
  10.  
  11. return 0;
  12. }
  13. ...
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. /** @file mainwindow.h */
  2.  
  3. #ifndef MAINWINDOW_H
  4. #define MAINWINDOW_H
  5.  
  6. #include "struct.h"
  7.  
  8. ...
  9.  
  10. #endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode 

and when i call fnc from mainwindow.cpp
Qt Code:
  1. InitLine(NewLine);
To copy to clipboard, switch view to plain text mode 

the compile output is:
.../mainwindow.cpp:702: undefined reference to `int InitLine<TMyStruct>(TMyStruct*)'