Jump to content
  • Advertisement
Sign in to follow this  
King of Men

Problem with makefiles

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

I have two packages; call them Main and Support. I would like to make Main use a class that is defined in Support. To that end, my Main.cc file has these lines in it :
#include "Support/SupportClass.hh"

(...)

SupportClass* mySupport = new SupportClass();
Now, I can compile this, but when I try to link I get the error Main.cc:lineNumber: undefined reference to `SupportClass::SupportClass()` Well, the argumentless constructor is certainly defined, in SupportClass.cc. What can I do (at the makefile level, I think) to so that make becomes aware of it? There is probably something trivially simple that I've forgotten, but I've been banging my head at this for two hours and am no longer seeing the trees; the bark is getting in the way.

Share this post


Link to post
Share on other sites
Advertisement
If you're writing the makefile yourself, you should probably post it, and if it's automatically generated, you should probably tell us what program is generating it (such as your IDE).

Share this post


Link to post
Share on other sites
Quote:
Original post by King of Men
Main.cc:lineNumber: undefined reference to `SupportClass::SupportClass()`

Well, the argumentless constructor is certainly defined, in SupportClass.cc. What can I do (at the makefile level, I think) to so that make becomes aware of it? There is probably something trivially simple that I've forgotten, but I've been banging my head at this for two hours and am no longer seeing the trees; the bark is getting in the way.

In principal, the makefile seems to link the Main.cc's object file without having the SupportClass.cc's object file at hand. Either the latter one isn't compiled correctly (so that the compiler hasn't created the object file, but then the makefile should fail _before_ linking), or it isn't listed as a file to be linked.

(As Mike2343 and smart_idiot already stated correctly, give us more information.)

Share this post


Link to post
Share on other sites
Either you are not linking with SupportClass.o file or SupportClass constructor has not public visibility.

Share this post


Link to post
Share on other sites
Hmm, you're right, I haven't given you enough information. But unfortunately, I can't give you a lot more, due to some proprietary issues. I guess I'll have to solve it myself. :(

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!