[Dev-C++] Template member function (C++ obviously)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: P.D. v. Z. <pa...@my...> - 2003-07-27 11:58:21
|
Hi, I'm trying to implement a pointer-to-member callback function in one of my classes, and I finally seem to have the syntax right. I have a member function whose prototype looks like this: template<typename T> void Parse(const std::string& strFile, T* pClass, bool (T::* pCB)(const ConfigLine&)) It's a member function of a non-template class ConfigParser. When I try to use this function however, I get a linker error. "[Linker error] undefined reference to `void ConfigParser::Parse<Config>(std::string const&, Config*, bool (Config::*)(ConfigLine const&))'" Now I've browsed through numerous tutorials, checked my "The C++ Programming Language" book, and did a bunch of Google searches, but I still can't find what I'm doing wrong. I could send the relevant code along, but won't bother you with it just yet. I would guess that if I define and implement the template function, I shouldn't be getting any linker errors for whatever type I put into it. I hope anyone can help me, cause I'm starting to consider making the entire class a template, just to get rid of the linker error. I already switched from Visual C++ 6 to GCC because of one of the many bugs in VC++6, one of which is that it doesn't seem to understand/support template member functions. Thanks in advance, Paul |