Visual Studio

From Eigen
Revision as of 21:23, 16 January 2013 by Jitse Niesen (Talk | contribs)

Jump to: navigation, search

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

  1. 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.
  2. In Visual Studio, make a new project (File | New | Project) using the Empty Project template.
  3. Add a C++ file to the project (Project | Add New Item, choose the C++ File template).
  4. 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.
  5. 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).
  6. Compile the program (Debug | Build Solution, or press F7).
  7. Run the program (Debug | Start debugging, or press F5).

Compiling the tests with CMake

  1. Start CMake (cmake-gui).
  2. Fill in where to find the source (the EIGENDIR folder) and where to build the binaries (e.g., EIGENDIR/build).
  3. Press Configure and Generate.
  4. Start Visual Studio and open the Eigen solution in the build directory. This takes several minutes.
  5. All tests are displayed as projects in the solution and can thus be built and run individually.