I'm building an evolution simulator in C++, but not as a "real" runnable program, but rather a class that other programs should #include
. This class, called World
, has some functions such as update()
, getInfo()
, etc...
I'm facing two problems here. First off, I don't know how exactly should I compile the class, and which files should I provide the user program (the one that #include
s the class) with. Obviously, the program should receive the .hpp
file, but what else? An object file of the class World
? That would imply that I'd need to compile the user program with the g++ World.o user.o -o user
syntax, but is there a way to avoid doing that (mentioning World.o
in my compile commands)? The same way I don't need to include iostream.o
in the compile command.
The second problem is that the World
class #include
s some other classes, such as Organism
, which, in turn, has to include the Block
class in order to inherit from it. How can I compile this code in order to get a single World.o
file (if that is the answer to problem 1)?