Jan 20

How to build Ceres under windows...

Note: All this junk is not required anymore :P, ceres has been patched.


 Ceres Solver [1] is an open source C++ library for modeling and solving large, complicated optimization problems. It is a feature rich, mature and performant library which has been used in production at Google since 2010. Ceres Solver can solve two kinds of problems.
  1. Non-linear Least Squares problems with bounds constraints.
  2. General unconstrained optimization problems.

Hopefully, it becomes easier to compile under windows than it used to be..

Start the fun to build it under windows: P

  1. Download CERES ^^, ceres-solver-1.10.0
  2. Download Eigen , Current Release 3.2.4
  3. Download Glog, glog-0.3.3
    1. Compil will fail: error C2039 std:min not member of std…
    2. => In logging.cc, #include <algorithm>
    3. In logging.cc, replace //_asm int 3 with   __debugbreak();


  1. Compilation should be successful in Debug and Release now, (tested with VS2013-VS2012 in X64)


  1. Download Gflags, use CMake, it compiles…don’t forget to run install and update Install_prefix_path, such as E:\Dev\LIB\Gflags\gflags-2.1.2\X64Release
  2. Download Suitesparse-metis-for-windows,
    1. Go there https://github.com/jlblancoc/suitesparse-metis-for-windows/releases
    2. Get the latest Release : For me it was v1.2.3, https://github.com/jlblancoc/suitesparse-metis-for-windows/archive/v1.2.3.zip
    4. Configure and build


  1. Finally, Use Cmake on Ceres folder
    1. You can have to add missing entry like for GFlags, GFLAGS_NAMESPACE
    2. Fill all field according to the following screenshot, I did not try to configure the project by using the METIS LIBRARY
    3. ceres_a ceres_b ceres_c ceres_d


  1. All example projects and CERES should build then , but as mentioned some example projects required the need to add shlwapi.lib to handle this annoying error LNK2019 __imp_PathMatchSpecA
  2. => you can fix this also if you need the example by adding shlwapi.lib in the CMAKE_CXX_STANDARD_LIBRAIRIES of CERES