Skip to content

Commit

Permalink
Fix Windows compilation in image_publisher.cpp (#1061)
Browse files Browse the repository at this point in the history
PR #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.
  • Loading branch information
traversaro authored Jan 6, 2025
1 parent 4c0f33d commit 86f51ab
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions image_publisher/src/image_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <cmath>
#include <chrono>
#include <limits>
Expand Down

0 comments on commit 86f51ab

Please sign in to comment.