J
John Harrison
william xuuu said:Actually, I also got linker errors with template functions and template
classes. And I avoided both of them successfully, by pouring foo.cpp
into foo.h, according to the C++ FAQ.
(http://www.parashift.com/c++-faq-lite/containers-and-templates.html)
And then, I pre-declared each template friend function above the
definition of template class. But I still get template friends linker
error. My compiler is gcc 3.3.3. Any hints? Thanks,
Probably your 'pre-declaration' is not the same as your actual definition.
So the linker tries to find the definiton for you pre-declaration and finds
nothing. Show us the code.
Don't #include foo.cpp in foo.h, that just makes things unnecessarily
complicated. Put everthing into foo.h and throw away foo.cpp. You know it
makes sense.
john