I am trying to rebuild existing C++ code for the ARM64 platform using Visual Studio 2022. (The build works well for the x86 and x64 platforms.) Most of the compilation succeeds but for one file that uses some Win32 API calls. I am getting dozen messages like
Error C3861 '_InterlockedIncrement': identifier not found
Error C3861 '_InterlockedExchangeAdd': identifier not found
Error C3861 'WriteRelease8': identifier not found
Error C3861 'WriteNoFence8': identifier not found
...
I do use some of these functions (in particular InterlockedIncrement
- no underscore), but not all of them. They are declared in WinNT.h
, included via Windows.h
.
To investigate, I have recreated a dummy project from scratch that includes Windows.h
and references InterlockedIncrement
. This compiles seamlessly. I have compared all build settings, including all paths (VC++ Directories), and could not find any significant difference.
I am also getting
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(514,5):
warning MSB8028: The intermediate directory (ARM64\Release\) contains files shared from another project (Formats.vcxproj). This can lead to incorrect clean and rebuild behavior.
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2301,5):
warning MSB3270: There was a mismatch between the processor architecture of the project being built "" and the processor architecture of the reference "System.Data", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
but I can't find the reason. I am not sure that this is directly related to the above problem. Note that the project is unmanaged C++ and has no reference, so that "the processor architecture of the reference "System.Data", "AMD64"
" seems irrelevant.
What am I missing ?
Update:
I discovered hidden references in the project (not appearing in the IDE) and cleaned that. This solves the second issue. (The first remains.)