skapunch/box2d

missing #include <string.h>

Closed this issue · 5 comments

There are a few files missing the definition of memcpy and memset.

Box2D\Box2D\Collision\Shapes\b2ChainShape.cpp
Box2D\Box2D\Collision\b2DynamicTree.cpp
Box2D\Box2D\Common\b2BlockAllocator.cpp

So far, the error only shows up when building for Android.

Easy fix, just add #include <string.h>.

Original issue reported on code.google.com by isaacbu...@gmail.com on 5 Nov 2013 at 4:09

That's because it is including <memory.h> instead of <string.h>. Some (many) 
compilers treat these two headers as synonyms, but <memory.h> is non standard, 
so in some environments it may even not exist.

The easiest solution is to replace any occurrence of <memory.h> with <string.h>.

Original comment by rodrigor...@gmail.com on 7 Dec 2013 at 9:34

Would <cstring> not be more standard?

Original comment by Jonno.5000 on 15 Dec 2013 at 12:01

Yes, it seems that <cstring> is more standard for C++.  Here's a patch for this.

Original comment by stalb...@gmail.com on 15 Mar 2014 at 3:58

Attachments:

Revision: 302
Message:
Fix for issue 322.
----
Modified : /trunk/Box2D/Box2D/Collision/Shapes/b2ChainShape.cpp
Modified : /trunk/Box2D/Box2D/Collision/b2DynamicTree.cpp
Modified : /trunk/Box2D/Box2D/Common/b2BlockAllocator.cpp

Original comment by erinca...@gmail.com on 4 Apr 2014 at 4:26

  • Changed state: Fixed
Issue 325 has been merged into this issue.

Original comment by erinca...@gmail.com on 4 Apr 2014 at 5:30