Browse Source

Windows: near and far undef cause failure when including Windows headers

Fixes #689
pull/690/head
Samuel Longchamps 3 months ago
parent
commit
09a0a5b944
  1. 8
      src/Magnum/Math/Frustum.h
  2. 8
      src/Magnum/Math/Matrix4.h
  3. 8
      src/Magnum/SceneGraph/Camera.h
  4. 8
      src/Magnum/Trade/CameraData.h

8
src/Magnum/Math/Frustum.h

@ -43,8 +43,16 @@
#include "Magnum/Math/Vector4.h"
#ifdef CORRADE_TARGET_WINDOWS /* I so HATE windef.h */
/* far/near and FAR/NEAR are defined by minwindef.h, but the former are used by this file as variables.
While they are all empty defines, the Windows headers expect FAR/NEAR to be defined and so we redefine them here.
far/near are left undefined because they are not used directly in Windows headers.
*/
#undef near
#undef NEAR
#define NEAR
#undef far
#undef FAR
#define FAR
#endif
namespace Magnum { namespace Math {

8
src/Magnum/Math/Matrix4.h

@ -38,8 +38,16 @@
#include "Magnum/Math/Vector4.h"
#ifdef CORRADE_TARGET_WINDOWS /* I so HATE windef.h */
/* far/near and FAR/NEAR are defined by minwindef.h, but the former are used by this file as variables.
While they are all empty defines, the Windows headers expect FAR/NEAR to be defined and so we redefine them here.
far/near are left undefined because they are not used directly in Windows headers.
*/
#undef near
#undef NEAR
#define NEAR
#undef far
#undef FAR
#define FAR
#endif
namespace Magnum { namespace Math {

8
src/Magnum/SceneGraph/Camera.h

@ -36,8 +36,16 @@
#include "Magnum/SceneGraph/visibility.h"
#ifdef CORRADE_TARGET_WINDOWS /* I so HATE windef.h */
/* far/near and FAR/NEAR are defined by minwindef.h, but the former are used by this file as variables.
While they are all empty defines, the Windows headers expect FAR/NEAR to be defined and so we redefine them here.
far/near are left undefined because they are not used directly in Windows headers.
*/
#undef near
#undef NEAR
#define NEAR
#undef far
#undef FAR
#define FAR
#endif
namespace Magnum { namespace SceneGraph {

8
src/Magnum/Trade/CameraData.h

@ -35,8 +35,16 @@
#include "Magnum/Trade/visibility.h"
#ifdef CORRADE_TARGET_WINDOWS /* I so HATE windef.h */
/* far/near and FAR/NEAR are defined by minwindef.h, but the former are used by this file as variables.
While they are all empty defines, the Windows headers expect FAR/NEAR to be defined and so we redefine them here.
far/near are left undefined because they are not used directly in Windows headers.
*/
#undef near
#undef NEAR
#define NEAR
#undef far
#undef FAR
#define FAR
#endif
namespace Magnum { namespace Trade {

Loading…
Cancel
Save