Skip to content

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

@spacelg

Description

@spacelg

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions