How to compile and install CAPD library under Windows?

Step by step tutorial 


In this tutorial I do not try to explain every possibility, I just describe configuration that I am using. I compile CAPD library with GNU compiler g++ which comes with Dev-C++ package. I hope that following this simple procedure everybody can make his own version of CAPD library working. If you have any question or you get stuck during compilation process please let me know I will try to help you. In email please attache informations like compilator logs, error messages etc.
  1. Install Dev-C++ 
    Download Dev-C++ 5.0 with Mingw/GCC and install it.
    I have used default installation directory C:\DEV-CPP. If you choose another directory then you need to make appropriate changes in the next steps.

  2. Install Active Perl
    Download Active Perl Standard Distribution and install. Again I have chosen default installation directory C:\Perl
    Perl is a temporary tool for CAPD. It is mainly used for compatibility with Linux to change path e.g. from  ../../bin/taylor.exe into ..\..\bin\tayor.exe. In fact CAPD library downloaded from our website should compile without it but you will go into trouble when you order make to clean object files or create directory. So I highly recommend to install Perl on your computer.

  3. Add to PATH variable directories that contains g++,  make and perl 
    You need to add directories C:\dev-cpp\bin and C:\Perl\bin to the system variable PATH.
    We need this to write shortly g++ instead of C:\dev-cpp\bin\g++.

    On Windows XP go to My Computer->Properties and on  Advanced tab choose Environment variables. Then in system variables find and edit Path variable. Add  C:\dev-cpp\bin;  to be first directory on a path (semicolon is used to separate directories).  Check if C:\perl\bin is already present, if not add also this directory. 
    If you have no rights to add anything to system variables you can add to local user variable also named Path.

     
  4. Download CAPD package and unpack it
    Download the most recent version of the CAPD library source code distribution from the CAPD website at capd.wsb-nlu.edu.pl.
    Unpack the downloaded file into an empty directory (I will call it CAPD_DIR, for example let CAPD_DIR=E:\capd). 

    To unpack archive simply double click on it to enter into it and then copy and paste all files into empty directory.


  5. Compile CAPD package
    Run terminal (Start->Run... : cmd)
    Go into CAPD_DIR and run  make target=win command
    E:
    cd capd
    make target=win
    It will take some time because not only library is compiled but also tests, programs and examples. 

    Common errors:

    There are many additional parameters that can be passed to make. They are explained in details in the readme file and on the web page.

  6. Install  CAPD package into Dev-C++ 
    This step is optional but is useful if you want to write, compile and run your code using Dev-C++ environment.
    After the CAPD library has been successfully compiled, one can install it by copying the contents of the CAPD_DIR\include directory to the C:\dev-cpp\include directory, and the contents of the CAPD_DIR\lib directory to C:\dev-cpp\lib.

  7. Write and compile your own program that uses CAPD library
    Good point to start with is to read and modify examples which are contained in example directory. After step 5 they are already compiled and executables are stored in the  bin directory.
    1. Using Dev-C++ environment
      To use the Dev-C++ environment it is recommended to install compiled CAPD package as it was described in the Step 6.
      • Create new project (You can choose if you want console aplication or GUI aplication, but it can be changed later in Project Options)
      • Open Project->Project Options and on Paremeters tab add to the Linker options:  
        -l capd
      • Create new source file or add to project existing one.

        To test your settings you can add file  CAPD_DIR\examples\taylor\tayltst.cpp.
        In this case you have to choose Windows GUI Application.

      • Compile (Ctrl+F9) and Run (Ctrl+F10) your project (they are in Execute menu).
    2. Using automated compilation which is built in CAPD 
      • In CAPD_DIR create directory private, 
      • In directory private create directory for your new project e.g. PROJECT,
      • To PROJECT directory copy makefile from one of the examples, e.g. CAPD_DIR\examples\taylor\makefile
      • Create your C++ source files e.g. main_file.cpp, tools.cpp, tools.h
      • Modify makefile
        In PROGS variable list all files that contains main function,
        in OTHERS list cpp files that should be compiled and linked with PROGS files,
        set GUI to 0 for console application and to 1 for GUI application,
        you can also specify SUBDIR - the name of directory where object files will be created. 
        In our example makefile can look like this
        # a list of all the programs in your package
        PROGS = main_file

        # a list of all your units to be linked with your programs
        OTHERS = tools

        # the CAPD libraries to use (if different from the global one)
        LIBRARY =

        # define "GUI = 0" for console applications, otherwise GUI is assumed
        GUI = 1

        # a subdirectory for storing the object files of this program group
        SUBDIR = project


        # ===========================================================================
        # Include the generic makefile for this project.
        # ===========================================================================

        include ../../make/makeprog
      • from command prompt in directory PROJECT run command
        make target=win 
      • The result of compilation (file main_file.exe) should appear in CAPD_DIR\bin directory