windows 应用程序无法正确启动 (0xc000007b)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10492037/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 09:30:23  来源:igfitidea点击:

The application was unable to start correctly (0xc000007b)

windowsdelphi64-bit

提问by Mawg says reinstate Monica

I have a client/server app which I have been developing on a single PC. Now it needs two serial ports, so I borrowed a PC from a friend.

我有一个客户端/服务器应用程序,我一直在一台 PC 上开发它。现在它需要两个串口,所以我向朋友借了一台PC。

When I build my app and try to run or debug it (whether in the Delphi IDE or from Windows File manager), it errors "The application was unable to start correctly (0xc000007b)".

当我构建我的应用程序并尝试运行或调试它时(无论是在 Delphi IDE 中还是从 Windows 文件管理器中),它都会出错“应用程序无法正确启动 (0xc000007b)”。

Googling doesn't bring up much, but seems to indicate that this is nothing Delphi specific and happens with other apps. It seems to be caused by calling into a 32 bit DLL from a 64 bit app or vice versa.

谷歌搜索并没有提出太多,但似乎表明这不是 Delphi 特有的,并且会在其他应用程序中发生。这似乎是由于从 64 位应用程序调用 32 位 DLL 引起的,反之亦然。

  • both PCs are Windows 7, 64 bit
  • both have Delphi Xe2 starter edition which can only handle 32 bits
  • The app runs fine on my PC, but not on my friend's
  • Other Delphi apps run just fine on both PCs
  • 两台电脑都是 Windows 7, 64 位
  • 两者都有只能处理 32 位的 Delphi Xe2 入门版
  • 该应用程序在我的电脑上运行良好,但在我朋友的电脑上运行不正常
  • 其他 Delphi 应用程序在两台 PC 上都运行良好

Can anyone give me a hint as to how to track this down?

谁能给我一个关于如何追踪这个的提示?

采纳答案by mox

To start, I would suggest to test whether there is a problem between your application and its dependencies using dependency walker

首先,我建议使用dependency walker测试您的应用程序及其依赖项之间是否存在问题

回答by David Heffernan

A load time dependency could not be resolved. The easiest way to debug this is to use Dependency Walker. Use the Profile option to get diagnostics output of the load process. This will identify the point of failure and should guide you to a solution.

无法解析加载时间相关性。调试它的最简单方法是使用Dependency Walker。使用 Profile 选项获取加载过程的诊断输出。这将确定故障点并引导您找到解决方案。

The most common cause of this error is trying to load a 64 bit DLL into a 32 bit process, or vice versa.

此错误的最常见原因是尝试将 64 位 DLL 加载到 32 位进程中,反之亦然。

回答by Alex.kononov

It is a missing dll. Possibly, your dll that works with com ports have an unresolved dll dependence. You can use dependency walker and windows debugger. Check all of the mfc library, for example. Also, you can use nrCommlib - it is great components to work with com ports.

这是一个缺少的dll。可能,您的 dll 与 com 端口一起使用具有未解决的 dll 依赖性。您可以使用依赖项walker 和windows 调试器。例如,检查所有 mfc 库。此外,您可以使用 nrCommlib - 它是使用 com 端口的绝佳组件。

回答by unxnut

I tried all the things specified here and found yet another answer. I had to compile my application with 32-bit DLLs. I had built the libraries both in 32-bit and 64-bit but had my PATHset to 64-bit libraries. After I recompiled my application (with a number of changes in my code as well) I got this dreaded error and struggled for two days. Finally, after trying a number of other things, I changed my PATHto have the 32-bit DLLs before the 64-bit DLLs (they have the same names). And it worked. I am just adding it here for completeness.

我尝试了此处指定的所有内容并找到了另一个答案。我必须用 32 位 DLL 编译我的应用程序。我已经构建了 32 位和 64PATH位库,但我设置为 64 位库。在我重新编译我的应用程序(我的代码中也有一些更改)之后,我遇到了这个可怕的错误并挣扎了两天。最后,在尝试了许多其他事情之后,我将我PATH的 32 位 DLL更改为 64 位 DLL(它们具有相同的名称)。它奏效了。我只是为了完整起见在这里添加它。

回答by pktCoder

It has been mentioned in earlier answers that using dependency walker is the way to go, in my case (my application keeps failing with the error code), dependency walker showed a few dll that are NOT relevant!

在之前的答案中已经提到,使用dependency walker 是可行的方法,在我的情况下(我的应用程序不断失败并显示错误代码),dependency walker 显示了一些不相关的 dll!

Finally figured out that I can run profiling by going to "profile" menu and it will run the application and stop at the exact dll that's cause the problem! I found out a 32bit dll was picked because of path and fixed it.

终于发现我可以通过转到“配置文件”菜单来运行分析,它将运行应用程序并在导致问题的确切 dll 处停止!我发现因为路径而选择了一个 32 位的 dll 并修复了它。

enter image description here

在此处输入图片说明

回答by user3731622

I experienced the same problem developing a client-server app using Microsoft Visual Studio 2012.

我在使用 Microsoft Visual Studio 2012 开发客户端-服务器应用程序时遇到了同样的问题。

If you used Visual Studio to develop the app, you must make sure the new (i.e. the computer that the software was not developed on) has the appropriate Microsoft Visual C++ Redistributable Package. By appropriate, you need the right year and bit version (i.e. x86 for 32 bit and x64 for 64 bit) of the Visual C++ Redistributable Package.

如果您使用 Visual Studio 开发应用程序,则必须确保新的(即未开发该软件的计算机)具有适当的 Microsoft Visual C++ Redistributable Package。根据适当的情况,您需要 Visual C++ Redistributable Package 的正确年份和位版本(即 x86 用于 32 位,x64 用于 64 位)。

The Visual C++ Redistributable Packages install run-time components that are required to run C++ applications built using Visual Studio.

Visual C++ Redistributable Packages 安装运行使用 Visual Studio 构建的 C++ 应用程序所需的运行时组件。

Here is a link to the Visual C++ Redistributable for Visual Studio 2015 .

这是Visual Studio 2015Visual C++ Redistributable的链接。

You can check what versions are installed by going to Control Panel -> Programs -> Programs and Features.

您可以通过转到控制面板 -> 程序 -> 程序和功能来检查安装了哪些版本。

Here's how I got this error and fixed it:

这是我得到这个错误并修复它的方法:

1) I developed a 32 bit application using Visual Studio 2012 on my computer. Let's call my computer ComputerA.

1) 我在我的电脑上使用 Visual Studio 2012 开发了一个 32 位应用程序。让我们称我的计算机为 ComputerA。

2) I installed the .exe and the related files on a different computer we'll call ComputerB.

2) 我将 .exe 和相关文件安装在我们称为 ComputerB 的另一台计算机上。

3) On ComputerB, I ran the .exe and got the error message.

3) 在 ComputerB 上,我运行 .exe 并收到错误消息。

4) On ComputerB, I looked at the Programs and Features and didn't see Visual C++ 2012 Redistributable (x64).

4) 在 ComputerB 上,我查看了程序和功能,但没有看到 Visual C++ 2012 Redistributable (x64)。

5) On ComputerB, I googled for Visual C++ 2012 Redistributable and selected and installed the x64 version.

5) 在 ComputerB 上,我搜索了 Visual C++ 2012 Redistributable 并选择并安装了 x64 版本。

6) On ComputerB, I ran the .exe on ComputerB and did not receive the error message.

6) 在ComputerB 上,我在ComputerB 上运行.exe 并没有收到错误消息。

回答by mitchfish36

I recently had an issue where I was developing an application (that used a serial port) and it worked on all the machines I tested it on but a few people were getting this error.

我最近在开发一个应用程序(使用串行端口)时遇到了一个问题,它在我测试过的所有机器上都可以运行,但有一些人遇到了这个错误。

It turns out all the machines that the error happened on were running Win7 x64 and had NEVER ONCE been updated.

事实证明,发生错误的所有机器都运行 Win7 x64,并且从未更新过。

Running a Windows update fixed all of the machines in my particular case.

在我的特殊情况下,运行 Windows 更新修复了所有机器。

回答by Solve101

Actually this error indicates to an invalid image format. However, why this is happening and what the error code usually means? Actually this could be appear when you are trying to run a program that is made for or intended to work with a 64 bit Windows operating system, but your computer is running on 32 bit Operating system.

实际上,此错误表明图像格式无效。但是,为什么会发生这种情况以及错误代码通常意味着什么?实际上,当您尝试运行专为或打算与 64 位 Windows 操作系统一起使用的程序,但您的计算机在 32 位操作系统上运行时,可能会出现这种情况。

Possible Reasons:

可能的原因:

  • Microsoft Visual C++
  • Need to restart
  • DirectX
  • .NET Framework
  • Need to Re-Install
  • Need to Run the application as an administrator
  • 微软 Visual C++
  • 需要重启
  • DirectX
  • .NET 框架
  • 需要重新安装
  • 需要以管理员身份运行应用程序

Source: http://www.solveinweb.com/solved-the-application-was-unable-to-start-correctly-0xc000007b-click-ok-to-close-the-application/

来源:http: //www.solveinweb.com/solved-the-application-was-unable-to-start-correctly-0xc000007b-click-ok-to-close-the-application/

回答by nucleon

In my case the error occurred when I renamed a DLL after building it (using Visual Studio 2015), so that it fits the name expected by an executable, which depended on the DLL. After the renaming the list of exported symbols displayed by Dependency Walker was empty, and the said error message "The application was unable to start correctly" was displayed.

在我的情况下,当我在构建 DLL 后重命名它(使用 Visual Studio 2015)时发生错误,因此它符合依赖于 DLL 的可执行文件所期望的名称。重命名后,Dependency Walker 显示的导出符号列表为空,并显示上述错误消息“应用程序无法正确启动”。

So it could be fixed by changing the output file name in the Visual Studio linker options.

因此可以通过更改 Visual Studio 链接器选项中的输出文件名来修复它。

回答by Bill Greer

I have seen the error trying to run VC++ debug executable on a machine which did not have Visual C++ installed. Building a release version and using that fixed it.

我看到尝试在没有安装 Visual C++ 的机器上运行 VC++ 调试可执行文件时出现错误。构建一个发布版本并使用它修复它。