# Problem with makefiles

## 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 on other sites
What compiler are you using?

##### Share on other sites
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 on other sites
Quote:
 Original post by King of MenMain.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.

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

##### 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. :(