windowsvisual-c++visual-studio-2017procmon

Previously working executable now gives application error at runtime


I recently copied C++ source code I am developing in VS2017 from my desktop (running Win 10) to my new laptop (running Win 11).

Although the code compiles and links successfully, I now encounter a 0xc000007b error whenever I attempt to run the executable.

Editing my debug environment variables to point to SysWOW64 instead of system32 has removed some issues in terms of finding standard dlls (msvcr100.dll etc). However, the same runtime error persists.

I have tried porting my solution to VS2022, but this does not help. Updating to newer versions of SDL 2.0 also make no difference.

Running the executable as an administrator does not solve the problem.

I have run ProcMon, and include a portion of the output here. partial ProcMon output


Solution

  • So Dependency Walker revealed that my project was calling a x64 version of mscvr100.dll. It still isn't clear exactly how this happened. Simply running a repair install of the 2015-2022 VS C++ redistributable didn't solve the problem, so I had to manually download a new version of the dll from dll-files.com.

    My diagnosis and repair followed the video below almost to the letter, except that I placed the latest versions of msvcr100.dll into the system directories (x86 in SysWOW64 and x64 in system32), rather than placing anything in the executable directory.

    https://youtu.be/eedlkWEo27s?feature=shared

    The 0xc000007b error now longer appears when running the executable.