Jump to content
  • Advertisement
Sign in to follow this  
Fish Fishes

External templates

This topic is 4906 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Receiving error: error LNK2019: unresolved external symbol "public: void __thiscall moBitmap<unsigned int>::Copy(unsigned int *,int)" (?Copy@?$moBitmap@I@@QAEXPAIH@Z) referenced in function "unsigned long __stdcall moPrepareThread(void *)" (?moPrepareThread@@YGKPAX@Z) How to organize cpp file?

Share this post


Link to post
Share on other sites
Advertisement
In practice, the implementation of the template needs to be available in the same translation unit that uses it. This means that (on almost any compiler) the following does not work:

temp.h: template declaration
temp.cpp: template definition (implementation)
program.cpp: includes temp.h

Instead, do this:

temp.h: template declaration and definition
program.cpp: include temp.h

In other words, don't put the template implementation in a separate file.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!