Original issue 147 created by sandwichmaker on 2014-05-14T10:43:22.000Z:
I realized that I have introduced a new warning when using a DLL installation of Ceres on Windows.
When the user includes <ceres/ceres.h> they will se a dozen warnings of the type: warning C4251: 'ceres::CostFunction::parameter_block_sizes_' : class 'std::vector<ceres::int32,std::allocator<_Ty>>' needs to have dll-interface to be used by clients of class 'ceres::CostFunction'
I missed this because C4251 has been silenced in the Ceres CMakeLists.txt.
The MSDN documentation clearly states that this warning can be ignored when it comes to stl classes, but it sould be documented how to shut it up.
There are a couple ways to work around this: 1. Tell the user to add the following to there CMakeLists.txt:
IF (MSVC) # Disable the warning C4251 which is trigerred by stl classes in # Ceres' public interface. To quote MSDN: "C4251 can be ignored " # "if you are deriving from a type in the Standard C++ Library" ADD_DEFINITIONS("/wd4251") ENDIF (MSVC) 1. Alternatively, tell the user to include Ceres like this:
ifdef _MSC_VER
// Disable the warning C4251 which is trigerred by stl classes in // Ceres' public interface. To quote MSDN: "C4251 can be ignored " // "if you are deriving from a type in the Standard C++ Library"
pragma warning( push )
pragma warning( disable : 4252 )
endif
include <ceres/ceres.h>
ifdef _MSC_VER
pragma warning( pop )
endif
3: Or do this for the user like Eigen does with DisableStupidWarnings.h and ReenableStupidWarnings.h.
该提问来源于开源项目:ceres-solver/ceres-solver