User Tools

Site Tools


windows_compilation

This short guide describes the steps necessary to compile oofem using Microsoft Visual c++ compiler.

Compiling trunk (svn) version and versions 1.9 and later

These instructions are valid since revision 326.

  1. for trunk version, get the development version from svn repository. This requires to have svn client installed. If you don't have any, you can try TortoiseSVN client. For release version, download it from oofem website and unpack it.
  2. Create a new, empty project (Win32 console application).
  3. In the oofem top directory, create src/config directory. Download oofemcfg.h and oofemdef.h files into this directory.
  4. Add all source files, located in src/oofemlib, src/oofemlib/xfem, src/config, src/sm, src/tm, src/fm, and src/dss sub-directories, into the project.
  5. Add also src/main/main.C and src/main/usrdefsub.C files.
  6. In the project settings [Menu:Project→Properties, select Configuration Properties→C/C++→Advanced→Compile As), add “/TP” compiler option. This will force “.C” files to be recognized as c++ files. Make sure, that you set this option for all targets.
  7. Under Project Configuration Properties→C/C++→General, add all subdirectories under scr directory to the “Additional Include Directories” item.
  8. Under the Project Configuration Properties→C/C++→Preprocessor→Preprocessor Definitions, add set of symbols “__MODULENAME_MODULE”, where the MODULENAME is the name of module(s) you want to include. For example, add “__OOFEMLIB_MODULE; __SM_MODULE; __TM_MODULE; __FM_MODULE; __DSS_MODULE” if you want to include oofemlib, sm, tm, fm, and dss modules (recommended). Also define “__OOFEM”, “__ENABLE_COMPONENT_LABELS” and “DEBUG” (if you want a debug version of OOFEM) macros.
  9. For version 1.9, open sm/src/compodamagemat.C, locate “CompoDamageMat :: ~CompoDamageMat();” (the semicolon at the end is important!) and if found, delete this line.
  10. Now you should be ready to build oofem solver executable.

Compiling release version (1.8)

  1. Create a new, empty project (Win32 console application)
  2. Add all relevant files into the project. Identify modules that you need (oofemlib must be included). The relevant files can be easily explored from makefile templates located in OOFEM_TOP_DIR/base directory)
  3. In the project settings, add “/TP” compiler option. This will force “.C” files to be recognized as c++ files.
  4. Get oofemcfg.h and oofemdef.h files from OOFEM_TOP_DIR/base directory. Then #define HAVE_BOOLTYPE, TIME_WITH_SYS_TIME and HAVE_MACRO_VA_ARGS.
  5. Under the VC project option/preprocessor definition, define set of symbols “__MODULENAME_MODULE”, where the MODULENAME is the name of module(s) you want to include. For example, define“ __SM_MODULE” and “__OOFEMLIB_MODULE” if you want to include oofemlib and sm modules. Also define “__OOFEM” and “DEBUG” (if you want a debug version of OOFEM) macros.
  6. Open inverseit.h header file, and find out the “z” definition. Then change the original definition into
    FloatArray* z=new(FloatArray[nc]);

    and don’t forget to add

    delete [] z;

    at the end of usage;

  7. In timer.h file, some functions only have declaration but no definitions in the corresponding cpp file. Comment out the following declarations:
    //timersub(&end_wtime, &start_wtime, &etime);
    //timeradd(&etime, &elapsedWTime, &elapsedWTime);
    //timersub(&end_utime, &start_utime, &etime);
    //timeradd(&etime, &elapsedUTime, &elapsedUTime);
    //start_utime=end_utime; start_wtime=end_wtime;
  8. Lack of #define clock.h statement in clock.h file, which would produce “redefinition” compile errors.
windows_compilation.txt · Last modified: 2010/10/21 17:46 by bp