diff --git a/cmake/GtsamBuildTypes.cmake b/cmake/GtsamBuildTypes.cmake index 06b25ab06..15a02b6e8 100644 --- a/cmake/GtsamBuildTypes.cmake +++ b/cmake/GtsamBuildTypes.cmake @@ -81,6 +81,11 @@ if(MSVC) WINDOWS_LEAN_AND_MEAN NOMINMAX ) + # Avoid literally hundreds to thousands of warnings: + list_append_cache(GTSAM_COMPILE_OPTIONS_PUBLIC + /wd4267 # warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data + ) + endif() # Other (non-preprocessor macros) compiler flags: diff --git a/gtsam/nonlinear/Values-inl.h b/gtsam/nonlinear/Values-inl.h index ff220044a..d0f8a4790 100644 --- a/gtsam/nonlinear/Values-inl.h +++ b/gtsam/nonlinear/Values-inl.h @@ -348,7 +348,9 @@ namespace gtsam { throw ValuesKeyDoesNotExist("at", j); // Check the type and throw exception if incorrect - return internal::handle()(j,item->second); + // h() split in two lines to avoid internal compiler error (MSVC2017) + auto h = internal::handle(); + return h(j,item->second); } /* ************************************************************************* */