Ode build failed with error C3861 in MSVC

Issue #78 resolved
Former user created an issue

Hello, I'm a member of Microsoft VCPKG, when I built this port in an internal version of Visual Studio, it failed with following errors:

C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1433~1.316\bin\Hostx64\x64\cl.exe   /TP -DCCD_IDEDOUBLE -DODE_DLL -DODE_EXPORTS -D_CRT_SECURE_NO_DEPRECATE -D_OU_FEATURE_SET=_OU_FEATURE_SET_ATOMICS -D_OU_NAMESPACE=odeou -D_OU_TARGET_OS=_OU_TARGET_OS_WINDOWS -D_SCL_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DdATOMICS_ENABLED -DdBUILTIN_THREADING_IMPL_ENABLED -DdIDEDOUBLE -DdOU_ENABLED -DdTRIMESH_ENABLED -DdTRIMESH_OPCODE -IF:\Lily\1017\buildtrees\ode\x64-windows-dbg\include -IF:\Lily\1017\buildtrees\ode\x64-windows-dbg\ode\src -IF:\Lily\1017\buildtrees\ode\src\0.16.1-4fa7add51b.clean\include -IF:\Lily\1017\buildtrees\ode\src\0.16.1-4fa7add51b.clean\ode\src -IF:\Lily\1017\buildtrees\ode\src\0.16.1-4fa7add51b.clean\ode\src\joints -IF:\Lily\1017\buildtrees\ode\src\0.16.1-4fa7add51b.clean\ou\include -IF:\Lily\1017\buildtrees\ode\src\0.16.1-4fa7add51b.clean\OPCODE -IF:\Lily\1017\buildtrees\ode\src\0.16.1-4fa7add51b.clean\OPCODE\Ice /nologo /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP  /D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 /showIncludes /FoCMakeFiles\ODE.dir\ode\src\fastldltfactor.cpp.obj /FdCMakeFiles\ODE.dir\ /FS -c F:\Lily\1017\buildtrees\ode\src\0.16.1-4fa7add51b.clean\ode\src\fastldltfactor.cpp
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.33.31629\include\__msvc_int128.hpp(115): error C3861: '_addcarry_u64': identifier not found
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.33.31629\include\__msvc_int128.hpp(129): error C3861: '_subborrow_u64': identifier not found
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.33.31629\include\__msvc_int128.hpp(247): error C3861: '_udiv128': identifier not found

This error is caused by atomic.h is including MSVC's <intrin.h> in a namespace. This ends up declaring _addcarry_u64 etc. within namespace odeou, so later when <__msvc_int128.hpp> tries to use those intrinsics, they can't be found (in the global namespace where they should be).

This error can resolved by moving #include <intrin.h> from Line 577 to Line 400 in file ou/include/ou/atomic.h. Could you please fix this problem? If you need any information, please contact me directly. Thanks in advance.

Comments (2)

  1. Log in to comment