Fix compilation in Visual C++ 2013. I had to fix the following things to make Ceres compile in 2013: * Not link to 'm' (GNU math library). * Excplicitly convert an std::ostream to bool. * Include <algorithm> for std::max. Change-Id: I3ff65413baf8711364360d46dd71fd553fa63e72
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 28eec9b..ac96de8 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt
@@ -41,11 +41,13 @@ TARGET_LINK_LIBRARIES(curve_fitting ceres) ADD_EXECUTABLE(curve_fitting_c curve_fitting.c) +TARGET_LINK_LIBRARIES(curve_fitting_c ceres) # As this is a C file #including <math.h> we have to explicitly add the math # library (libm). Although some compilers (dependent upon options) will accept # the indirect link to libm via Ceres, at least GCC 4.8 on pure Debian won't. -TARGET_LINK_LIBRARIES(curve_fitting_c ceres m) - +IF (NOT MSVC) + TARGET_LINK_LIBRARIES(curve_fitting_c m) +ENDIF (NOT MSVC) ADD_EXECUTABLE(robust_curve_fitting robust_curve_fitting.cc) TARGET_LINK_LIBRARIES(robust_curve_fitting ceres)
diff --git a/examples/pgm_image.h b/examples/pgm_image.h index 15e99e4..1328d75 100644 --- a/examples/pgm_image.h +++ b/examples/pgm_image.h
@@ -197,7 +197,7 @@ outputfile << static_cast<int>(data_[i] + 0.5) << ' '; } - return outputfile; // Returns true/false + return bool(outputfile); // Returns true/false } namespace {
diff --git a/internal/ceres/test_util.cc b/internal/ceres/test_util.cc index a3f67bd..8af48ab 100644 --- a/internal/ceres/test_util.cc +++ b/internal/ceres/test_util.cc
@@ -30,6 +30,7 @@ // // Utility functions useful for testing. +#include <algorithm> #include <cmath> #include "ceres/file.h" #include "ceres/stringprintf.h"