I am creating an evolution simulator in C ++, but not as a “real” executable program, but as a class that other programs should #include. This class, called World, has some functions, such as update(), getInfo()etc.
I have two problems here. Firstly, I don’t know how exactly I should compile the class and what files I should provide to the user program (the one that the #includeclass). Obviously, the program should receive the file .hpp, but what else? The class object file World? This would mean that I would need to compile the user program with the syntax g++ World.o user.o -o user, but is there a way to avoid this (mentioned World.oin my compilation commands)? Similarly, I do not need to include iostream.oin the compilation command.
The second problem is that the Worldclass is #includesome other classes, such as Organism, which, in turn, must include the class Blockin order to inherit from it. How can I compile this code to get a single file World.o(if this is the answer to problem 1)?
source
share