Compilation on Windows - PIK-LPJmL/LPJmL GitHub Wiki

Compilation of LPJmL on a Windows machine

TOC

Compiling using nmake in a windows shell

compiler

On Windows based systems, you need to have a compiler, e.g. the one that comes with the Visual Studio Express. See also configure visual studio express

**** have a look at your LPJROOT/config/Makefile.win32 and make sure that the system include and lib directories are specified. The paths below are just (outdated) exmaples, please make sure these are correct for your systems' settings:

 CFLAGS  = $(LPJFLAGS) -D_USE_MATH_DEFINES  -I"c:\program files\Microsoft Platform SDK for Windows Server 2003 R2\include"

and

    LNOPTS = "/libpath:$(VCINSTALLDIR)\lib" "/libpath:c:\program files\Microsoft Platform SDK for Windows Server 2003 R2\lib" advapi32.lib ws2_32.lib -out:

steps for compilation

Run the script configure.bat which configures your Makefile.inc for your system. Remember that all compiled executables are specific to the machine on which it has been compiled.

Call nmake in your console window to compile just the LPJmL exe (will be stored in the bin subfolder) or `nmake all to also compile all the utility programs (exes will also be stored in the bin folder), libraries from individual sub-directories will bin in the lib directory.

Run nmake clean to remove all object files and libraries if you want to have a fresh start before running nmake or nmake all

Compiling using Visual Studio Express

On Windows based systems, there is no C compiler directly available and you’ll need to download the Visual Studio Express to get one. We recommend using the 2015 version (even though that is not available for download any more, but the most recent release -- 2017 -- has no feature to build projects from existing code :confounded:). As Visual Studio comes with a developer environment as well (alternatively, you can use the Java-based Eclipse), you can also use Visual Studio Express to navigate through the code. In this case, you need to configure the project, as Visual Studio does not read the Makefiles … See configure visual studio 2015 for instructions.