From b289c3cc11162cb4712eddc855ee8a321dfe93f0 Mon Sep 17 00:00:00 2001 From: Zardshard <0azrune6@zard.anonaddy.com> Date: Fri, 4 Aug 2023 13:28:24 -0400 Subject: [PATCH] Fix multiple definitions linker error This error occurs when including agg_trans_perspective.h in multiple source files and then linking them together. This fix is inspired by the surrounding code, which avoids the problem by declaring functions as inline. --- agg-src/include/agg_trans_perspective.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/agg-src/include/agg_trans_perspective.h b/agg-src/include/agg_trans_perspective.h index 1c650aac..b7979e12 100644 --- a/agg-src/include/agg_trans_perspective.h +++ b/agg-src/include/agg_trans_perspective.h @@ -502,7 +502,7 @@ namespace agg } //------------------------------------------------------------------------ - const trans_perspective& + inline const trans_perspective& trans_perspective::multiply_inv(const trans_perspective& m) { trans_perspective t = m; @@ -511,7 +511,7 @@ namespace agg } //------------------------------------------------------------------------ - const trans_perspective& + inline const trans_perspective& trans_perspective::multiply_inv(const trans_affine& m) { trans_affine t = m; @@ -520,7 +520,7 @@ namespace agg } //------------------------------------------------------------------------ - const trans_perspective& + inline const trans_perspective& trans_perspective::premultiply_inv(const trans_perspective& m) { trans_perspective t = m; @@ -529,7 +529,7 @@ namespace agg } //------------------------------------------------------------------------ - const trans_perspective& + inline const trans_perspective& trans_perspective::premultiply_inv(const trans_affine& m) { trans_perspective t(m); @@ -697,14 +697,14 @@ namespace agg } //------------------------------------------------------------------------ - void trans_perspective::translation(double* dx, double* dy) const + inline void trans_perspective::translation(double* dx, double* dy) const { *dx = tx; *dy = ty; } //------------------------------------------------------------------------ - void trans_perspective::scaling(double* x, double* y) const + inline void trans_perspective::scaling(double* x, double* y) const { double x1 = 0.0; double y1 = 0.0; @@ -719,7 +719,7 @@ namespace agg } //------------------------------------------------------------------------ - void trans_perspective::scaling_abs(double* x, double* y) const + inline void trans_perspective::scaling_abs(double* x, double* y) const { *x = std::sqrt(sx * sx + shx * shx); *y = std::sqrt(shy * shy + sy * sy);