简体   繁体   中英

0xC000026F: An internal error occurred in the Win32 x86 emulation subsystem

I'm trying to code in Visual Studio 2022 17.2.3 on Parallels Desktop (Macbook Pro 14" M1 Pro). The program was built successfully but when it was running, this exception came up:

Unhandled exception at 0x00007FFE6CFD85F0 (msvcp140d.dll) in Test.exe: 0xC000026F: An internal error occurred in the Win32 x86 emulation subsystem.

I wouldn't call this a definitive answer, but after a load of prune&test'ing with my code; (I had one project that ran fine, and another that didn't) this code alone would cause the exception mentioned above;

#include <iomanip>

int main()
{
    return 0;
}

My exception (before main ) was here;

cerr.cpp

#pragma warning(disable : 4074)
#pragma init_seg(compiler)
static std::_Init_locks initlocks;

I have the same issue, open the Configuration Manager and change Platform to Win32 should resolve this issue.

配置的样子

I assume you are building and debugging an x64 application, so that's the solution I'm posting here. However, the same principle applies to arm64 debugging if you're running into the same problem.

The problem is your path does not include the debug x64 version of the Visual C++ runtime. So the system tries to grab the arm64 version instead, and crashes because the machine code is the wrong architecture.

The simplest way to fix this is to go to the directory containing the Visual Studio non-redistributable debug libraries (something like C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.32.31326\debug_nonredist - the exact path is slightly different depending on which version of VS you have installed). Then go to the particular architecture you want (x64 here), then the library (Microsoft.VC143.DebugCRT), then copy the file (msvcp140d.dll) into the same directory as the application you are launching (normally something like bin\x64\debug - check your project settings).

This will allow the DLL loader to find the x64 binary first, and load that up. Then you'll be able to debug your application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM