October 27, 2024
Chicago 12, Melborne City, USA
C#

Box2d clang: In included file: conflicting types for 'operator-'


I just added the Box2D library (#include <box2d/box2d.h>) to my project (C++17) and encountered several errors like the ones listed below.

**In file included from /Users/me/.conan2/p/b/box2dd2031ba5ab13f/p/include/box2d/box2d.h:7:
In file included from /Users/me/.conan2/p/b/box2dd2031ba5ab13f/p/include/box2d/collision.h:7:
/Users/me/.conan2/p/b/box2dd2031ba5ab13f/p/include/box2d/math_functions.h:614:15: error: conflicting types for 'operator-'
  614 | inline b2Vec2 operator-( b2Vec2 a, b2Vec2 b )
      |               ^
/Users/me/.conan2/p/b/box2dd2031ba5ab13f/p/include/box2d/math_functions.h:602:15: note: previous definition is here
  602 | inline b2Vec2 operator-( b2Vec2 a )
      |               ^
/Users/me/.conan2/p/b/box2dd2031ba5ab13f/p/include/box2d/math_functions.h:626:15: error: conflicting types for 'operator*'
  626 | inline b2Vec2 operator*( b2Vec2 a, float b )
      |               ^
/Users/me/.conan2/p/b/box2dd2031ba5ab13f/p/include/box2d/math_functions.h:620:15: note: previous definition is here
  620 | inline b2Vec2 operator*( float a, b2Vec2 b )
      |               ^
2 errors generated.
make[2]: *** [CMakeFiles/carimbo.dir/cmake_pch.hxx.pch] Error 1
make[1]: *** [CMakeFiles/carimbo.dir/all] Error 2
make: *** [all] Error 2**

What is the problem?



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video