0xc000007b“应用程序无法正确启动"错误? [英] 0xc000007b "The application was unable to start correctly" error?

查看:111
本文介绍了0xc000007b“应用程序无法正确启动"错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Visual Studio 2019中编写了一个C ++控制台应用程序,并试图将其部署到另一台Windows笔记本电脑上.两台笔记本电脑都是最新的64位Windows 10,并且我的目标笔记本电脑已安装/最新的.NET Framework,vc_redist.x64.exe和DirectX.

I've written a C++ console application in Visual Studio 2019 and am trying to deploy it to another windows laptop. Both laptops are up-to-date with 64 bit Windows 10, and my target laptop has installed/up-to-date .NET Framework, vc_redist.x64.exe, and DirectX.

关于部署方法,我遵循了

In terms of deployment method, I followed this Microsoft walkthrough word for word, with the added step of ensuring that my newly created "setup" project was also targeting x64 platform, since some of the external libraries in my code required x64. The resulting "setup" .exe/.msi pair work as planned on the source laptop - installs and runs with no frills required.

在目标笔记本电脑上安装正常,但是启动该程序将给出本文标题中提到的错误.经过几个小时的尝试,我认为我已经知道问题的根源,但首先,我将分享我尝试过的方法,这基本上是找到的所有建议通过搜索此错误代码:

Installation goes fine on the target laptop, but launching the program gives the error mentioned in the title of this post. After a few hours of trying to figure it out, I think I have an idea where the problem is coming from, but first, I'll share what I've tried, which is basically every recommendation found by googling this error code:

  • 干净启动
  • SFC扫描
  • chkdsk c:/f/r
  • 修复/全新安装第一段中提到的所有框架
  • 以管理员身份运行应用程序安装程序和已安装的应用程序
  • 所有这些更改后,
  • 重新启动笔记本电脑并重新安装应用程序

我认为是问题的根源:

在VS中的安装/部署项目中,三个检测到的依赖项"(MSVCP140D.dll,ucrtbased.dll,VCRUNTIME140D.dll)具有通过…\ System32 \的文件路径,而不是在…中找到的相同依赖项.\ SysWOW64.检测到的其他两个依赖关系是外部64位DLL(这就是为什么我将整个项目都指定为x64的原因).当我通过Dependency Walker运行应用程序时,它同意前面提到的三个依赖关系是错误的CPU类型",而后面两个依赖关系很好.但是,这种情况不能向我解释为什么在源笔记本电脑上安装/运行(在VS之外)可以正常工作(如果VS打包了32位和64位依赖项的混合版本,那不行吗?em>).实际上,通过源便携式计算机上的Dependency Walker运行该应用程序可以发现与目标便携式计算机上的功能完全相同-相同的3个依赖项是错误的CPU类型",但是该应用程序在此处运行.

In the setup/deployment project in VS, three of the "detected dependencies" (MSVCP140D.dll, ucrtbased.dll, VCRUNTIME140D.dll) have filepaths through …\System32\ rather than the identical dependencies that could be found in …\SysWOW64. The other two detected dependencies are external 64-bit DLLs (which is why I specified my entire project to x64). When I run my application through Dependency Walker, it agrees that the three formerly mentioned dependencies are "wrong CPU type", while the two latter ones are fine. This scenario does not, however, explain to me why install/run (outside of VS) works fine on the source laptop (shouldn't it not work if VS is packaging a mix of 32 and 64 bit dependencies?). In fact, running the application through Dependency Walker on the source laptop reveals the exact same thing as on the target laptop - the same 3 dependencies are "wrong CPU type", yet the application runs here.

我在VS中看不到用于更改设置"项目以读取64位文件路径的选项.我曾尝试过在各个阶段手动交换64位DLL(包括在DLL交换和应用程序运行之间重新启动计算机),但这似乎没有任何效果.实际上,我尝试用SysWOW64文件夹中的DLL替换System32文件夹中的3个相关DLL(我的廉价解决方案是无法更改文件路径-仅更改文件),这导致我得到了源笔记本电脑上的错误与目标笔记本电脑上的错误相同.

I do not see an option in VS to change the "setup" project to read the 64 bit filepath. I have tried manually swapping in the 64-bit DLLs at various stages (including restarting the computer between DLL swap and application run), which did not seem to have any effect. In fact, I tried replacing the 3 relevant DLLs in the System32 folder with the DLLs from the SysWOW64 folder (my idea of a cheap workaround for not being able to change the filepath - just change the file) and this just caused me to get the same error on my source laptop as I had been getting on my target laptop.

所有这些东西对我来说都是相对较新的,所以请让我知道我是否愚蠢地忽略了我的过程/项目的一些基本细节-如果是这样的话,这很不错,而且很容易修复.

All of this stuff is relatively new to me, so please let me know if I'm foolishly overlooking some fundamental detail with my process/project - at this point it would be nice if that were the case and this is easy to fix.

推荐答案

在我注意到上面的评论已经回答之前写了这个.只是留在里面.

Wrote this before I noticed the above comment had already answered. Just leaving it in.

调试二进制文件 :您似乎已部署了二进制文件的调试版本(文件名: MSVCP140D.dll ).尝试以发布模式进行编译并部署新的二进制文件.

Debug Binary: Looks like you have deployed a debug version of your binary (The D in the file name: MSVCP140D.dll). Try to compile in Release mode and deploy the new binary.

原因 :调试二进制文件通常需要 VCRedist 二进制文件的调试版本才能存在于包装盒中您尝试运行二进制文件-它们仅在安装了SDK(和/或Visual Studio)的开发人员PC上可用.该错误消息: 0xc000007b 表示"STATUS_INVALID_IMAGE_FORMAT".

提示 :此处有一些资源链接以及一些有关如何操作的提示调试部署问题.

这篇关于0xc000007b“应用程序无法正确启动"错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆