Advertisement Jump to content
Sign in to follow this  


This topic is 4752 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

Could anyone tell me how to get this functionality that I want? I have this function in a class
template<class T>
	void DrawToBuffer( std::vector<T> &objects );

which I call like this:
e->DrawToBuffer( objects );	

compiling this I get the following error: Error 70 error LNK2001: unresolved external symbol "public: void __thiscall _CEngine::DrawToBuffer<class _CSpaceShip>(class std::vector<class _CSpaceShip,class std::allocator<class _CSpaceShip> > &)" (??$DrawToBuffer@V_CSpaceShip@@@_CEngine@@QAEXAAV?$vector@V_CSpaceShip@@V?$allocator@V_CSpaceShip@@@std@@@std@@@Z) main.obj So basicly, I would like the array objects to be able to contain any class type to be sent to my draw function. How do I do that?

Share this post

Link to post
Share on other sites
It looks like you didn't provide definition of your templated function. When using templates your definitions of templated classes/functions have to be in same compilation unit as declaration.
If you have method implemented in another file then you just need to move it to the header.

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!