Jump to content
  • Advertisement

Archived

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

GeekPlusPlus

weird unresolved external symbols...

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

Howdy, i''ve got a weird issue. I have 2 classes and their function definitions all in a header file. lets call it header.h now when I move the function definitions to header.cpp, suddenly I get unresolved externals on everything. #include "header.h" is at the top of header.cpp, and they all have their scope defined... I don''t know if it matters they are both templated classes. Hope someone''s got an idea. Other than them being templated they seem to be setup like all my other classes which work fine. - Newb Programmer: Geek++

Share this post


Link to post
Share on other sites
Advertisement
quick thought... try this...

ex:
extern void function();

keyword: extern

edit:

put the function deffenitions in the header file with extern and then add them to the source file without it....

header file:
extern void function();

source file:
void function();


[edited by - no one on June 3, 2004 3:35:04 AM]

Share this post


Link to post
Share on other sites
Unless your compiler supports the export keyword, and I''m willing to bet that yours doesn''t, then you can''t put the definition of a template in a separate source file. The complete definition of the template needs to be available at point of instantiation, which means, in effect, that the definition needs to go into the header. (Or an inline file of some sort, etc.)

For more details see these articles: "Export" Restrictions, Part 1 and "Export" Restrictions, Part 2.

And since petewood no longer posts on the boards, I suppose I should post this link for him. It''s an article entitled "Instantiator: A (Mostly) Portable Framework for Separate Compilation of Templates"

Share this post


Link to post
Share on other sites
template classes has to be implemented in header (or include .inl/.cpp in header, as many do)

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.

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!