Revision as of 21:23, 16 January 2013 by Jitse Niesen
Here are some step-for-step procedures for using Eigen with Microsoft Visual Studio. This page is written using the 2010 Express version by somebody who is not familiar with Visual Studio, so feel free to correct and improve!
Compiling a simple Eigen program
- First you need to download Eigen. Using the TortoiseHg Workbench, select Clone Repository in the File menu, and use the URL https://bitbucket.org/eigen/eigen/ as source. Alternatively, download and unpack the zip file. I will denote by EIGENDIR the folder in which you store the Eigen library; this folder contains other folders like bench, blas, cmake and Eigen.
- In Visual Studio, make a new project (File | New | Project) using the Empty Project template.
- Add a C++ file to the project (Project | Add New Item, choose the C++ File template).
- Write your program in the file. For instance, copy and paste the first program at the Getting Started guide. To prevent the console window from closing immediately after the program finishes, add something like "std::cin.get();" at the end.
- Open the project properties page (Project | Properties), in the C++ folder open the General page, and after Additional Include Directories put EIGENDIR (the folder in which you store the Eigen library).
- Compile the program (Debug | Build Solution, or press F7).
- Run the program (Debug | Start debugging, or press F5).
Compiling the tests with CMake
- Start CMake (cmake-gui).
- Fill in where to find the source (the EIGENDIR folder) and where to build the binaries (e.g., EIGENDIR/build).
- Press Configure and Generate.
- Start Visual Studio and open the Eigen solution in the build directory. This takes several minutes.
- All tests are displayed as projects in the solution and can thus be built and run individually.