Jump to content
  • Advertisement

Archived

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

Pipo DeClown

Not-so-funny problem that I solved

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

So I made a templated class with functions! So I made everything compile! So it refused to link! Doh! Now the problem was, I''d get a ''undefined reference to..'' or in other words, the linker couldn''t find the actual function code. Now the answer was, that ALL templated functions (including templated class functions) should be INCLUDED in every file that uses them (or in a file like StdAfx.h, which includes everything). So now back to bizz.. Just wanted to share that with you all. Bye! .lick

Share this post


Link to post
Share on other sites
Advertisement
That sounds logical since it has to know it''s definition... nevertheless, it always feels nice when you solve a problem, doesn''t it :-)

Nice work
Albert

Share this post


Link to post
Share on other sites
Normally, I have a definition in a header file (.h) and the actual code I''d put in a source file (.cpp). Now the thing was that with templated functions (all of them), you have to include the source file where the functions were ''filled''.

.lick

Share this post


Link to post
Share on other sites
quote:
Original post by Pipo DeClown
Normally, I have a definition in a header file (.h) and the actual code I'd put in a source file (.cpp)

That will only work with templates if you are only calling the functions from within the same exact cpp file, which is actually rarely the case.


[edited by - Polymorphic OOP on September 24, 2003 3:32:02 PM]

Share this post


Link to post
Share on other sites
Perhaps the export keyword will fix this one day...

______________________________________________________________
The Phoenix shall arise from the ashes... ThunderHawk -- ¦þ
MySite
______________________________________________________________

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!