简体   繁体   English

应用程序在mingw-w64 / msys2中编译,“应用程序无法正确启动(0xc00007b”

[英]Application compiled in mingw-w64/msys2, “the application was unable to start correctly (0xc00007b”

After compiling an application in the mingw-w64 64-bit Shell , it runs fine inside the shell, but gives an error the application was unable to start correctly (0xc00007b) when run normally, outside the shell. mingw-w64 64-bit Shell编译应用mingw-w64 64-bit Shell ,它在shell中运行正常,但是在shell外部运行正常时, the application was unable to start correctly (0xc00007b)

I moved some of the necessary DLLs from the msys2/mingw-w64 bin directories when it complained about missing them, but now it gives this opaque error. 当我抱怨错过它们时,我从msys2 / mingw-w64 bin目录移动了一些必要的DLL,但现在它给出了这个不透明的错误。 What am I doing wrong? 我究竟做错了什么?

Error 0xc00007b basically means "invalid image format" which usually happens when mixing 64-bit and 32-bit DLLs. 错误0xc00007b基本上意味着“无效的图像格式”,通常在混合64位和32位DLL时发生。 What is happening, is that you have a 64-bit application, looking for a particular DLL, which is in the global path, but the one in the path is 32-bit. 这是怎么回事,是你有一个64位应用程序,寻找一个特定的DLL,这在全局路径,但一个路径是32位的。 Therefore, the problem is: it does not complain about the missing DLL, it just tries to load it. 因此,问题是:它不会抱怨丢失的DLL,它只是尝试加载它。 Since it is a 32-bit application, and your application is a 64-bit application, you get error 0xc00007b . 由于它是一个32位应用程序,并且您的应用程序是64位应用程序,因此会收到错误0xc00007b

The solution is to copy all the dependent DLLs over to the application path. 解决方案是将所有相关DLL复制到应用程序路径。

The next problem is you don't know which ones. 接下来的问题是你不知道哪些。

What you can do with msys2 shell is: go to the directory and run the command: 使用msys2 shell可以做的是:转到目录并运行命令:

ldd application.exe

This will give you a list of DLLs the application depends on. 这将为您提供应用程序所依赖的DLL列表。 Copy the msys2/mingw-w64 related DLLs to the directory. 将msys2 / mingw-w64相关的DLL复制到该目录。 This will allow the application to find them before looking in the PATH and finding the 32-bit DLLs. 这将允许应用程序在查找PATH并找到32位DLL之前找到它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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