Sign in to follow this  
King of Men

Problem with makefiles

Recommended Posts

King of Men    394
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
smart_idiot    1298
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
haegarr    7372
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
King of Men    394
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this