diff --git a/qgroundcontrol.pri b/qgroundcontrol.pri index 288672c0904a3a93ebb440c14caa61f6e1ec74fa..6e7d2e5136dbbc96df6b3ad001014d50302a4d1d 100644 --- a/qgroundcontrol.pri +++ b/qgroundcontrol.pri @@ -285,6 +285,9 @@ win32-msvc2008|win32-msvc2010 { # QWebkit is not needed on MS-Windows compilation environment CONFIG -= webkit + + # Specify the inclusion of (U)INT*_(MAX/MIN) macros within Visual Studio + DEFINES += __STDC_LIMIT_MACROS # For release builds remove support for various Qt debugging macros. CONFIG(release, debug|release) { diff --git a/src/ui/QGCVehicleConfig.cc b/src/ui/QGCVehicleConfig.cc index 858714cb29bed1b13dc9d252026467b49f9226c4..fef70f624d36b80249509b07bd50dba61af14901 100644 --- a/src/ui/QGCVehicleConfig.cc +++ b/src/ui/QGCVehicleConfig.cc @@ -1,4 +1,11 @@ +// On Windows (for VS2010) stdint.h contains the limits normally contained in limits.h +// It also needs the __STDC_LIMIT_MACROS macro defined in order to include them (done +// in qgroundcontrol.pri). +#ifdef WIN32 +#include +#else #include +#endif #include @@ -228,8 +235,8 @@ void QGCVehicleConfig::resetCalibrationRC() { for (unsigned int i = 0; i < chanMax; ++i) { - rcMin[i] = INT_MAX; - rcMax[i] = INT_MIN; + rcMin[i] = (float)INT_MAX; + rcMax[i] = (float)INT_MIN; } } @@ -318,7 +325,7 @@ void QGCVehicleConfig::remoteControlChannelRawChanged(int chan, float val) if (chan < 0 || static_cast(chan) >= chanMax || val < 500 || val > 2500) return; - if (chan + 1 > chanCount) { + if (chan + 1 > (int)chanCount) { chanCount = chan+1; }