undefined reference

I know there are several other posts about this issue, but none of the ones I can find have been helpful.

I'm trying for the first time to compile a fairly large codebase. Everything compiles fine except for two classes. This is an example of the compiler-error I get:


/tmp/ccZfRwyv.o: In function `GeometricObject::GeometricObject()':
GeometricObject.cpp:(.text+0x34): undefined reference to `RGBColor::RGBColor(float, float, float)'


The GeometricObject.h includes RGBColor.h, and GeometricObject has an instance of RGBColor, but none of the rest of the code references RGBColor. The RGBColor constructor mentioned in the error is defined:

 
RGBColor(const float nr, const float ng, const float nb);


and declared:

1
2
RGBColor::RGBColor(const float nr, const float ng, const float nb) : r(nr), g(ng), b(nb) {
}


As far as I can see, there is nothing wrong with either implementation or definition. Any clues?

Peace
If you have multiple source files, make sure you are linking every object file you need into the final binary
Yep, all the files are there. When I first encountered the issue, I realized that I HAD forgotten to include RGBColor when compiling, but now I have fixed that and the issue still remains.
what about linking?
I use: g++ foo1.cpp foo2.cpp foo3.cpp -o foo -lm
No IDE?
No, I'm only using gedit and g++ in terminal. I'm currently using a netbook, so I need as much screen real-estate as possible for the actual code. I find all the IDEs I've tried to clutter up my screen:p If you have a suggestion for a good IDE for netbook usage, I'd be grateful:)
Ok, I moved RGBColor to the beginning of the list of files in the g++ command, and now it appears to work. Does that make sense?
Dunno. If that is really an issue, compile like
g++ *.cpp -c #just compile, don't link
g++ *.o -o program.bin
Topic archived. No new replies allowed.