Nemo  2.3.46
Building and linking your project with Nemo

Once you have finished defining your additional elements, you have to link them with the framework to be able to use them in a simulation run. For that, you will have to actually write a real program (or modify the existing one). Therefore, you have to add a main() function somewhere in your code, compile it and link it against the nemo framework.

Here is how to write the main() function (in a main.cpp file):

#include "simulation.h"
#include "metapop.h"
#include "simenv.h"
#include "mytrait.h"
#include "mylce.h"
int main ( int argc, char **argv )
{
Metapop thePop;
//create a new SimRunner that will run the sim:
SimRunner *theSim = SIMenv::setMainSim( &thePop );
//attach your elements, the trait prototypes to the trait container:
theSim->add_trait( new MyTraitProto() );
//add the LCE to the LCE container:
theSim->add_LCE( new MyLce() );
//that's it, the simulation is ready to run!
if( !theSim->run(argc, argv) ) fatal( " could not run the sim !\n" );
//cleaning before quitting
delete theSim;
return 0;
}

Compile and link your project:

g++ -O3 -c mytrait.cpp -o mytrait.o
g++ -O3 -c mylce.cpp -o mylce.o
g++ -O3 -c main.cpp -o mytrait.o
g++ -o myprogram-1.0 mytrait.o mylce.o mytrait.o -lstdc++ -lnemo2.0

The commands above assume that the library libnemo2.0.dylib (or .so, or .dll, depending on the system) is on your path. Otherwise, give the path to the library with the -L option before -lnemo2.0 like this: g++ -o myprogram-1.0 ... -Lnemo-2.0/lib/ -lnemo2.0

Please have a look at the Makefile provided with the code release for more details.

<<prev | –t o p–


Generated for Nemo v2.3.0 by  doxygen 1.8.8 --
Catalogued on GSR