I'm sorry to bother you guys again Yet I'm still resolutely determined to learn C++ (while weird and illogical at times, it seems a powerful language; plus, C++ programming pays well, for what I know).
My question is, What if I need to declare a template function in a separate .cpp file, compile it and then link with the main program? I've Googled for it, and several tutorials say that I can't; I have to put the function definition in the .hpp, because "That's the way it works".
On the other hand, Bjarne Stroustroup says (in "The C++ programming language, 3rd ed.", page 351):The problem is, Microsoft VC++ doesn't understand the keyword 'export'. What can I do about it?Note that to be accessible from other compilation units, a template definition must be explicitly declared export (§9.2.3). This can be done by adding export to the definition or to a preceding declaration. Otherwise, the definition must be in scope wherever the template is used.
Thank you