For a month ago, I stumbled upon a weird problem in Eclipse. I have three projects—six actually—and these depends on each other: Main project needs Application project, Application project needs Kinect project. The Application and Kinect projects are built as library files—i.e. no executable.
As I had been programming on multi-projects in Visual Studio, only, I did not know exactly how to solve this, or even what to search for. I began searching for the error message “undefined reference to …”, this gave me no answers—hence why this is in the subject, so others can find the solution. What I thought, was I had missed to include a library in another project. Finally I found out that the problem was the link order in the Main project.
In my case I have these dependencies: Main -> (depends on) Application -> Kinect. In the Main project you need to use the same order: at the top Application, and below Application, Kinect.
This to me, is the opposite order what I think, i.e. Kinect needs to be included before Application since Application uses Kinect, but they probably use another train of thought. Note, that I don’t know how it works if let say Application uses Kinect and Kinect uses Application in some way (Application <-> Kinect). I avoid cross dependencies, as they have the ability to grow complex and are not, in my opinion, modular. I use an hierarchical approach, but a child can have any number of parents—e.g. projects AI, GameLogic, Kinect, and Input uses the Sound project, thus Sound has four parents; a very bad example, but I think you get the idea.