You need to actually pass in the libraries that have the functionality you are using as files to be compiled as well.
Example:
Directory structure:
Code:
Project
|-- dir1
| |-- blah.h
| |-- blah.cpp
| |-- blah2.h
| `-- blah2.cpp
|-- foo.h
|-- foo.cpp
|-- bar.h
`-- bar.cpp
Now say you are compiling foo.cpp (i.e., that has your
main() loop in it) and you use stuff that's in bar, blah, and blah2. First you'd have to compile bar.cpp, blah.cpp, and blah2.cpp into object files. Assuming that those each act independently of one another (i.e., you don't use functionality from one in the other), this would do:
Code:
~/dir1 $ g++ blah.cpp -o blah.o
~/dir1 $ g++ blah2.cpp -o blah2.o
~/dir1 $ cd ..
~ $ g++ bar.cpp -o bar.o
What happens there is that you simply compile the code into an object file that contains the chunks of functionality for each function within the .cpp file. It won't actually run, though, it's just chunks of functional code. For you to actually run something, you have to link it, and that's where your problem lies.
The problem is, you're including the
interface for all the stuff you are using (all the "#include <cppunit/..." stuff), but you aren't actually
linking in the functional chunks of code that actually
do the stuff. To do that, you have to compile the library together with it. For our example above, this would compile foo.cpp into an executable.
Code:
~ $ g++ dir1/blah.o dir1/blah2.o bar.o foo.cpp -o foo