Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

class templates

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

Hello Im trying to maek a class template to hold a type of vertex buffer. and i get the unresolved external symbol error when i compile. I declare the class like this template class vb { }; then the function definitions are like this template returnType vb::functionName() { } thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
Place the function definitions in the header file - the compiler needs to be able to see them when it instantiates your template class.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
If I''m not wrong, you have to supply template parameter, so:
template<class T> vb {
}

template void vb<T>::function()
{}

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
If I''m not wrong, you have to supply template parameter

You''re not wrong, but he has included that. It''s just that it''s been munged by your browser''s HTML parser.

Share this post


Link to post
Share on other sites
isn''t there a way i can have the definitions in a seperate cpp file? can i do anything with "extern" that might solve this prob?

thanks for input


:::Al:::
[Triple Buffer V2.0] - Resource leak imminent. Memory status: Fragile

Share this post


Link to post
Share on other sites
quote:
Original post by alfmga
isn''t there a way i can have the definitions in a seperate cpp file?

Yes. Buy Comeau 4.3.
quote:

can i do anything with "extern" that might solve this prob?

No. You''re going to have to live with it. What do you need them in a seperate file for anyway?

Share this post


Link to post
Share on other sites
quote:
No. You''re going to have to live with it. What do you need them in a seperate file for anyway?


ah well. ok

i dont *need* them in a seperate file, i just *like* them in a seperate file, but it''s all good Thanks anyway


:::Al:::
[Triple Buffer V2.0] - Resource leak imminent. Memory status: Fragile

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!