How to compile the source code of GEOtop 0.875
GEOtop is written in C programming language. That means that you could compile it theorically on every platform you have a C compiler. There are several ways to compile GEOtop. here you can find some examples, please choose the one that fit your needs. Note that you have to follow this steps after you have downloaded the source code (see the DownLoad GEOtop page for this phase).
Compiling the source of GEOtop 0.875 using makefiles
Open a console. First of all you have to go to the directory where you downloaded the 0.875 module that contains the GEOtop source files. From there you have to reache the makefile directory:
cd 0.875/BINARIES/Makefiles
then you need to create the makefile coping the right one for your platform, for example linux users should do:
cp geotop0875_linux.make makefile
and than you can run the compilation by typing:
make
Compiling GEOtop 0.875 with your preferred IDE
If you are used to compile C source code using IDE programs, follow this steps. We tested the compilation of GEOtop sources with the following popular IDE:
- Code Warrior (for MacOsX, Linux and Windows)
- Xcode (for MacOsX)
- KDevelop (open source, for Linux)
Dev-C++ (GNU GPL, for Windows)
Eclipse (multiplatform, Java based), but you need the C/C++ plugin. For this IDE we put down some italian instructions, at the CompileWithEclipse page. There are also english instruction for a proper compilation: compile_geotop.pdf.
No matter what kind of IDE you are using, you have to create a new project choosing "new empty project" or "console application" or something like that. Once you have created a new project, you have to import from the 0.875 directory into your project the requested C source files and the corresponding headers:
/0.875/APPLICATIONS/HYDROLOGY/geotop0.875/geotop.0.875.c /0.875/APPLICATIONS/HYDROLOGY/geotop0.875/io.geotop.0.875.c /0.875/APPLICATIONS/HYDROLOGY/geotop0.875/energy.balance.c /0.875/APPLICATIONS/HYDROLOGY/geotop0.875/pedo.funct.c /0.875/APPLICATIONS/HYDROLOGY/geotop0.875/struct.geotop.0.875.c /0.875/APPLICATIONS/HYDROLOGY/geotop0.875/water.balance.c /0.875/APPLICATIONS/HYDROLOGY/geotop0.875/water.sideflows.c /0.875/APPLICATIONS/HYDROLOGY/geotop0.875/geo_statistic.0875.c /0.875/LIBRARIES/BASICS/alloc.c /0.875/LIBRARIES/BASICS/error.c /0.875/LIBRARIES/BASICS/list.c /0.875/LIBRARIES/BASICS/t_io.c /0.875/LIBRARIES/BASICS/tensor3d.c /0.875/LIBRARIES/BASICS/utilities.c /0.875/LIBRARIES/BASICMATHSTAT/datamanipulation.c /0.875/LIBRARIES/BASICMATHSTAT/random.c /0.875/LIBRARIES/GEOMORPHOLOGYLIB/networks.c /0.875/LIBRARIES/GEOMORPHOLOGYLIB/write_dem.c /0.875/LIBRARIES/LINEARALGEBRA/linearalgebra.c
Don't forget to import the heders file corresponding to the source files, for example for geotop.0.875.c, the corresponding header is geotop.0.875.h.
At least another header file not corresponding to a source file is needed: turtle.h, located in /0.875//LIBRARIES/BASICS/, so please add this file to your project too.
If you are using the Dev-C++ IDE, note that for obtaining a compilation without errors, you need to copy and store al the above listed source and headers files into one new created directory, then you need to create the new project and everything should work.
Now you are ready to compile, link and build your GEOtop executable! For some explanations about the use of GEOtop please visit the GeoTopForBeginners page.
