Google Ceres Solver for Windows 64-Bit (Instructions and Binaries)

The Google Ceres Solver is a nonlinear least-squares solver. It’s an efficient library that can be used to solve nonlinear least-squares problems like fitting a cone, sphere or cylinder to a set of 3-dimensional points. If you want some good non-linear least-squares fit equations to use for the solver, you might want to take a look at this. Building the Ceres Solver on Windows, especially x64 Windows, is not a trivial task. Here we give the details necessary for building it from source and also provide 64-bit binaries for your convenience for Ceres Solver version 1.3.0. These instructions were created for the latest versions of the libraries available at the time of its writing. Newer libraries might require changes. These instructions are also specifically for Visual Studio but could be adapted to other compilers. Many of the steps below require a file extraction tool. Our favorite tool for Windows is 7-zip since it’s open source and handles most formats.

Building From Source

  1. Download Ceres Solver source (tar.gz file) from here.
  2. Download latest CMake binary (Windows 32-bit Installer) from here.
  3. Download the stable release of Eigen3 from here (tar.bz2, tar.gz or zip will all work).
  4. Download the latest google-glog logging library from here.
  5. Download the latest gflags commandline flags library from here (both tar.gz and zip will work).
  6. Make a toplevel directory for the dependencies, source and build files somewhere. Here we will assume you called it ceres.
  7. Unpack Ceres Solver into the ceres directory. You should get a directory in ceres such as ceres-solver-1.3.0.
  8. Unpack Eigen3 into ceres/eigen, google-glog into ceres/glog and gflags into ceres/gflags.
  9. Go into ceres/glog. Open src/windows/glog/logging.h and change from:


    Open src/windows/glog/config.h and change  #undef HAVE_LIB_GFLAGS to  #define HAVE_LIB_GFLAGS.

    Open src/ and comment out the line  _asm int 3 in the logging_fail static method.

  10. Load the project file in Visual Studio and build it. If desired (which it was for us) you may also want to build a debug version. By default it’s given the same name as the release. So go into the project’s Settings, General, Target Name and change it to end with a “_d” or whatever you’d like.
  11. Go into ceres/gflags, load the project file in Visual Studio and build it. If you want a debug version, follow the instructions in the previous step. However, you’ll also want to include the debug version of glog here so modify the project’s Settings, Linker, Inputs to reference the debug library built in the previous step.
  12. Make a directory ceres/ceres-bin for the build files.
  13. Run CMake and select the ceres-solver-X.Y.Z directory for the CMake file. Then select ceres-bin for the build directory.
  14. Run ‘Configure’. It will return errors for options that need to be filled in.
  15. Set GLOG_INCLUDE to the full path to ceres/gflags/src/windows.
  16. Set GLOG_LIB to the full path to ceres/gflags/Release/libgflags.lib.
  17. Set GFLAGS_LIB to the full path to ceres/glog/src/windows.
  18. Set GFLAGS_INCLUDE to ceres/glog/Release/libglog.lib.
  19. Open the solution in Visual Studio. Make the same changes here as described in step 10 above if you’d like a debug version built and make sure to reference the correct debug library names you created for glog and gflags in the projects that need them. Then build the solution which will put the resulting library files into ceres/ceres-bin/lib.
  20. In your own tool, you’ll have to add  #define GLOG_NO_ABBREVIATED_SEVERITIES before including ceres.

Here you can download the Windows 64-bit binaries of glog, gflags and ceres.

3 thoughts on “Google Ceres Solver for Windows 64-Bit (Instructions and Binaries)

  1. Thanks for writing up these instructions! Did you see the Windows build instructions in the manual? Consider contributing your instructions upstream where they are more likely to get found by Windows Ceres users.

    For what it’s worth, I didn’t do any of the gflags / logs changes that you did. I got all the tests to run and the examples. Blender ships with Ceres (and on win64), and I don’t think they made the “_asm int 3” change either. We’d like to work with you to make the Windows build easier if you feel like contributing.

    (one of the primary Ceres authors)

  2. Hi

    Thanks for the instructions. I tried to build Ceres under Windows 7 (64bit) using Visual Studio 2010.
    I went through your guide but ran into the following bug when trying to build Ceres with VS, no matter what I tried:

    Error 1 error C1189: #error : ERROR macro is defined. Define
    GLOG_NO_ABBREVIATED_SEVERITIES before including logging.h. See the document for detail. C:\glog-0.3.2\src\windows\glog\log_severity.h 55

    Any ideas on how to get rid of this? Have you been able to build it without this redefinition problem?

    • Hi Tom,

      That was actually the last step in my instructions. You have to add a #define GLOG_NO_ABBREVIATED_SEVERITIES before including Ceres. Or you could add it as a compiler option to define that variable.


Leave a Reply