From c3baf0d19cd2d56dd1e543fd46a4814e105bcd73 Mon Sep 17 00:00:00 2001
From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com>
Date: Mon, 6 Jan 2025 10:31:42 +0100
Subject: [PATCH] Fix Windows compilation in image_publisher.cpp (backport
#1061) (#1062)
PR https://github.com/ros-perception/image_pipeline/pull/985 added some
code that used `M_PI`, but `M_PI` is not defined in any standard, and
before including `cmath` or `math.h` in Windows it is necessary to
define `_USE_MATH_DEFINES` to ensure that `M_PI` is defined.
This is
an automatic backport of pull request #1061 done by
[Mergify](https://mergify.com).
Co-authored-by: Silvio Traversaro
---
image_publisher/src/image_publisher.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/image_publisher/src/image_publisher.cpp b/image_publisher/src/image_publisher.cpp
index 325c2852..a40f0441 100644
--- a/image_publisher/src/image_publisher.cpp
+++ b/image_publisher/src/image_publisher.cpp
@@ -31,6 +31,10 @@
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
+// This define is added to support M_PI on Windows
+#ifndef _USE_MATH_DEFINES
+#define _USE_MATH_DEFINES
+#endif
#include
#include
#include