I am trying to use a template function to overload the >> stream operator but keep getting unresolved external errors (VC++ 6.0).
The function definition and declaration are:
Any ideas?Code:// .h file ********************** #include <fstream> using namespace std; class BinStreamIn : public ifstream { public: BinStreamIn( const char *inputFileName ); void ReadBytes(void *inputBytes, int numOfBytesToInput); template <class T> BinStreamIn & operator>> (T &inputValue); . . . } //.cpp file *********************** template <class T> BinStreamIn & BinStreamIn::operator>> (T &inputValue) { BinStreamIn::ReadBytes( &inputValue, sizeof(inputValue) ); return *this; } // end function BinStreamIn::operator>> -------------------------- Linking... DataStreamReader.obj : error LNK2001: unresolved external symbol "public: class BinStreamIn & __thiscall BinStreamIn::operator>>(unsigned short &)" (??5BinStreamIn@@QAEAAV0@AAG@Z) Release/FEP.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe.



LinkBack URL
About LinkBacks



I used to be an adventurer like you... then I took an arrow to the knee.