How to Build IT++ on Windows?

Written by Yen-Huan Li, Nov., 2011.

IT++ is a very useful library for researchers in communication engineering and signal processing. It implements several algorithms written in C++ which enable communication researchers to write fast C++ simulation programs. One can find some examples on its documentation website. Unluckily, there is not an official guide on how to build IT++ in Windows. I tried one day long and figured out how to build it. Here is my summary.

What do we need?

  1. MinGW/MSYS
  2. FFTW Library
  3. LAPACK Library
  4. IT++ Library
  5. Code::Blocks (A free IDE for C/C++ programming, highly recommended)

Step by Step

  1. MinGW
    1. Download the latest installation file from the official download page.
    2. Double-click the .exe file to install. When asked for selcting elements to be installed, select all of the elements.
  2. FFTW
    1. Download FFTW from its official website and unzip the file.
    2. Open the MSYS command window.
    3. $cd [the directory of the unzipped file, e.g. c:\fftw-3.3.2]
    4. $./configure --prefix=/mingw
    5. $make
    6. $make install
  3. LAPACK
    1. Download LAPACK from its official website and unzip the file.
    2. Rename the file “make.inc.example” as “make.inc”.
    3. Open the MSYS command window.
    4. $cd [the directory of the unzipped file]
    5. $make blaslib
    6. $make lapacklib
    7. Copy the files “librefblas.a” and “liblapack.a” to “[where you install MinGW]\lib\”, and rename the former one as “libblas.a”.
  4. IT++
    1. Download IT++ from its official website, and unzip the file.
    2. Open the MSYS command window.
    3. $cd [the directory of the unzipped file]
    4. $./configure --prefix=/mingw
    5. $make && make install
    6. $make check
    7. Create a test C++ source file named “test.cpp”. (You may copy any one of the examples in this page.)
    8. $cd [where the source file is]
    9. $g++ test.cpp -o test -litpp -lfftw3 -llapack -lblas -llibgfortranbegin -llibgfortran
    10. $./test
  5. Code::Blocks (recommended)

You may feel it annoying to type so long a command to compile a source file. One way to avoid it is to set the linker settings in some IDE for C++ programming. I suggest Code::Blocks. After setting the linker settings, you can compile and build your C++ source file by simply clicking “build” in Code::Blocks.

  1. Download Code::Blocks from its official site and install it.
  2. During the installation, Code::Blocks will auto-detect available C++ compilers in your computer. Choose “GNU GCC Compiler” as default.
  3. Open Code::Blocks and choose “settings”->“Compiler and debugger...”->“link settings”.
  4. Add libitpp.a, libfftw3.a, liblapack.a, and libblas.a in order. You should not change the order; otherwise you will get error messages when compiling. All of the above files are under the directory “[where you install MinGW]\lib\”. Then add libgfortranbegin.a and libgfortran.a. You can find the two files under the directory “[where you install MinGW]\lib\gcc\mingw32\4.4.0\” (the vesion number may be different).
  5. Now you can compile and build any C++ file using the IT++ library by simply clicking “build” in Code::Blocks.

Remark

You can execute the compiled C++ program by click “run” in Code::Blocks. However, if you try to directly doubleclick the compiled .exe file to execute it, you will see an error message saying some .dll file is missing. You can find the .dll file under the directory “[where you install MinGW]\ bin”, and resolve the problem by copying the .dll file to the directory where the .exe file lies.

Reference