erincatto / box2d

Box2D is a 2D physics engine for games
https://box2d.org
MIT License
8.35k stars 1.55k forks source link

Box2d failed to build with error LNK2019 and error C3861: 'aligned_alloc': identifier not found on windows with MSVC target X86 #809

Closed spacelg closed 1 month ago

spacelg commented 1 month ago

Hi,

Box2d failed to build with error LNK2019: unresolved external symbol _aligned_alloc referenced in function _b2Alloc and error C3861: 'aligned_alloc': identifier not found on windows with MSVC target X86, it can be reproduced on latest version df7373c on main branch. Are builds targeting X86 no longer supported? Could you please help look at this issue? Thanks in advance.

Note: it can build pass on target X64.

Steps to reproduce the behavior:

  1. git clone https://github.com/erincatto/box2d C:\gitP\erincatto\box2d
  2. Open a VS2022 x86 cmd
  3. cd C:\gitP\erincatto\box2d && mkdir build_x86 && cd C:\gitP\erincatto\box2d\build_x86
  4. set CL=/wd4047
  5. cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_SYSTEM_VERSION=10.0.22621.0 ..
  6. msbuild /m /p:Platform=Win32 /p:Configuration=Release box2d.sln /t:Rebuild

Error Log: Build.log

ErrorMessage: 8>box2d.lib(core.obj) : error LNK2019: unresolved external symbol _aligned_alloc referenced in function _b2Alloc [C:\gitP\erincatto\box2d\build_x86\test\test.vcxproj] ... C:\gitP\erincatto\box2d\samples\main.cpp(74,14): error C3861: 'aligned_alloc': identifier not found [C:\gitP\erincatto\box2d\build_x86\samples\samples.vcxproj]

erincatto commented 1 month ago

I have not added support for 32-bit. What is the use case for 32-bit?

erincatto commented 1 month ago

I made some 32-bit fixes in #817. Win32 should build and run now.