C++ - 无法正确启动 (0xc0150002)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5126105/
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
C++ - unable to start correctly (0xc0150002)
提问by Simplicity
I'm trying to run an OpenCV
application through Microsoft Visual C++ 2010 Express
, and get the following message:
我正在尝试通过 运行OpenCV
应用程序Microsoft Visual C++ 2010 Express
,并收到以下消息:
How can I solve this issue?
我该如何解决这个问题?
回答by Latanius
I agree with Brandrew, the problem is most likely caused by some missing dlls that can't be found neither on the system path nor in the folder where the executable is. Try putting the following DLLs nearby the executable:
我同意 Brandrew 的观点,这个问题很可能是由一些丢失的 dll 引起的,这些 dll 在系统路径和可执行文件所在的文件夹中都找不到。尝试将以下 DLL 放在可执行文件附近:
- the Visual Studio C++ runtime (in VS2008, they could be found at places like C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86.) Include all 3 of the DLL files as well as the manifest file.
- the four OpenCV dlls (cv210.dll, cvaux210.dll, cxcore210.dll and highgui210.dll, or the ones your OpenCV version has)
- if that still doesn't work, try the debug VS runtime (executables compiled for "Debug" use a different set of dlls, named something like msvcrt9d.dll, important part is the "d")
- Visual Studio C++ 运行时(在 VS2008 中,它们可以在 C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86 等位置找到。)包括所有 3 个 DLL 文件以及清单文件。
- 四个 OpenCV dll(cv210.dll、cvaux210.dll、cxcore210.dll 和 highgui210.dll,或者你的 OpenCV 版本有的)
- 如果仍然不起作用,请尝试调试 VS 运行时(为“调试”编译的可执行文件使用一组不同的 dll,命名为 msvcrt9d.dll,重要的部分是“d”)
Alternatively, try loading the executable into Dependency Walker ( http://www.dependencywalker.com/), it should point out the missing dlls for you.
或者,尝试将可执行文件加载到 Dependency Walker ( http://www.dependencywalker.com/) 中,它应该会为您指出缺少的 dll。
回答by LastBlow
In my case, Visual Leak DetectorI was using to track down memory leaks in Visual Studio 2015 was missing the Microsoft manifest file Microsoft.DTfW.DHL.manifest
, see link Building Visual Leak Detectorall way down. This file must be in the folder where vld.dll
or vld_x64.dll
is in your configuration, say C:\Program Files (x86)\Visual Leak Detector\bin\Win32
, C:\Program Files (x86)\Visual Leak Detector\bin\Win64
, Debug
or x64/Debug
.
就我而言,我用来跟踪 Visual Studio 2015 中的内存泄漏的Visual Leak Detector缺少 Microsoft 清单文件Microsoft.DTfW.DHL.manifest
,请参阅链接Building Visual Leak Detector。该文件必须在文件夹中vld.dll
或者vld_x64.dll
是在您的配置,说C:\Program Files (x86)\Visual Leak Detector\bin\Win32
,C:\Program Files (x86)\Visual Leak Detector\bin\Win64
,Debug
或x64/Debug
。
回答by huy_gm
I got this error when trying to run my friend's solution file by visual studio 2010 after convert it to 2010 version. The fix is easy, I create new project, right click the solution to add existing .cpp and .h file from my friend's project. Then it work.
我在将朋友的解决方案文件转换为 2010 版本后尝试通过 Visual Studio 2010 运行它时出现此错误。修复很简单,我创建了新项目,右键单击解决方案以从我朋友的项目中添加现有的 .cpp 和 .h 文件。然后它工作。
回答by Brandrew
I take it that is a Vista Window! I often got this when first trying to port a DirectX program from XPsp3 to Vista.
我认为这是一个 Vista 窗口!当我第一次尝试将 DirectX 程序从 XPsp3 移植到 Vista 时,我经常遇到这个问题。
It's a .dll problem. The OpenCV runtime.dll will call upon a system.dll that will be no longer shipped Vista, so unfortunately you will have to to a bit of hunting to find which system.dll it's trying to find. (system.dll could be vc2010 or vista)
这是一个 .dll 问题。OpenCV runtime.dll 将调用一个将不再提供 Vista 的 system.dll,因此不幸的是,您将不得不寻找它正在尝试查找的 system.dll。(system.dll 可以是 vc2010 或 vista)
This error is also caused by incorrect installation of .dlls (i.e not rolling out) hth Happy hunting
此错误也是由于.dlls 安装不正确(即未推出)造成的 hth 快乐狩猎
回答by akash
Just run .exe file in dependency walker( http://dependencywalker.com/) and it will point you the missing dlls and download those dll (www.dll-files.com) and paste in the c:windows:system32 and the folder as your .exe and even provide the path of those dll in path variable.
只需在依赖项walker(http://dependencywalker.com/)中运行.exe文件,它就会指向你缺少的dll并下载这些dll(www.dll-files.com)并粘贴到c:windows:system32和文件夹作为您的 .exe,甚至在路径变量中提供这些 dll 的路径。
回答by user2716873
Even I faced same error, I fixed it afterwards... Two things you need to look into
即使我遇到了同样的错误,我后来修复了它......你需要研究两件事
- Whether your system path is correctly set in your environment variables
- Check the pre-processors in Project Properties->c/c++->Pre-processors. Check whether you have included
_CONSOLE
, this was causing error for me. For Some applications you need to includeWIN32;_WINDOWS;_CONSOLE;_DEBUG;QT_DLL;QT_GUI_LIB;QT_NETWORK_LIB;QT_CORE_LIB;COIN_DLL;SOQT_DLL;QT_DEBUG;
- 您的系统路径是否在您的环境变量中正确设置
- 在 Project Properties->c/c++->Pre-processors 中检查预处理器。检查您是否已包含
_CONSOLE
,这对我造成了错误。对于某些应用程序,您需要包括WIN32;_WINDOWS;_CONSOLE;_DEBUG;QT_DLL;QT_GUI_LIB;QT_NETWORK_LIB;QT_CORE_LIB;COIN_DLL;SOQT_DLL;QT_DEBUG;
I got this error while I was working in coin3D Application.
我在 coin3D 应用程序中工作时遇到了这个错误。
回答by Andrew
I met such problem. Visual Studio 2008 clearly said: problem was caused by libtiff.dll. It cannot be loaded for some reasom, caused by its manifest (as a matter of fact, this dll has no manifest at all). I fixed it, when I had removed libtiff.dll from my project (but simultaneously I lost ability to open compressed TIFFs!). I recompiled aforementioned dll, but problem still remains. Interesting, that at my own machine I have no such error. Three others comps refused to load my prog. Attention!!! Here http://www.error-repair-tools.com/ppc/error.php?t=0xc0150002one wise boy wrote, that this error was caused by problem with registry and offers repair tool. I have a solid guess, that this "repair tool" will install some malicious soft at your comp.
我遇到了这样的问题。Visual Studio 2008 明确表示:问题是由 libtiff.dll 引起的。由于其清单(事实上,这个 dll 根本没有清单),它由于某种原因无法加载。当我从我的项目中删除 libtiff.dll 时,我修复了它(但同时我失去了打开压缩 TIFF 的能力!)。我重新编译了上述dll,但问题仍然存在。有趣的是,在我自己的机器上我没有这样的错误。其他三个组合拒绝加载我的编。注意力!!!在这里http://www.error-repair-tools.com/ppc/error.php?t=0xc0150002一位聪明的男孩写道,这个错误是由注册表问题引起的,并提供了修复工具。我有一个可靠的猜测,这个“修复工具”会在你的电脑上安装一些恶意软件。
回答by ALM865
It is because there is a DLL that your program is missing or can't find.
这是因为您的程序缺少或找不到某个 DLL。
In your case I believe you are missing the openCV dlls. You can find these under the "build" directory that comes with open CV. If you are using VS2010 and building to an x86 program you can locate your dlls here under "opencv\build\x86\vc10\bin". Simply copy all these files to your Debug and Release folders and it should resolve your issues.
在您的情况下,我相信您缺少 openCV dll。您可以在 open CV 附带的“build”目录下找到这些。如果您使用 VS2010 并构建到 x86 程序,您可以在“opencv\build\x86\vc10\bin”下找到您的 dll。只需将所有这些文件复制到您的 Debug 和 Release 文件夹,它就会解决您的问题。
Generally you can resolve this issue using the following procedure:
通常,您可以使用以下过程解决此问题:
- Download Dependency Walker from here: http://www.dependencywalker.com/
- Load your .exe file into Dependency Walker (under your projects Debug or Release folder), in your case this would be DisplayImage.exe
- Look for any DLL's that are missing, or are corrupt, or are for the wrong architecture (i.e. x64 instead of x86) these will be highlighted in red.
- For each DLL that you are missing either copy to your Debug or Release folders with your .exe, or install the required software, or add the path to the DLLs to your environment variables (Win+Pause -> Advanced System Settings -> Environment Variables)
- 从这里下载 Dependency Walker:http: //www.dependencywalker.com/
- 将您的 .exe 文件加载到 Dependency Walker(在您的项目 Debug 或 Release 文件夹下),在您的情况下这将是 DisplayImage.exe
- 查找任何丢失、损坏或用于错误架构(即 x64 而不是 x86)的 DLL,这些 DLL 将以红色突出显示。
- 对于您丢失的每个 DLL,请使用 .exe 复制到您的 Debug 或 Release 文件夹,或者安装所需的软件,或者将 DLL 的路径添加到您的环境变量中(Win+Pause -> Advanced System Settings -> Environment Variables )
Remember that you will need to have these DLLs in the same directory as your .exe. If you copy the .exe from the Release folder to somewhere else then you will need those DLLs copied with the .exe as well. For portability I tend to try and have a test Virtual Machine with a clean install of Windows (no updates or programs installed), and I walk through the Dependencies using the Dependency Walker one by one until the program is running happily.
请记住,您需要将这些 DLL 与 .exe 放在同一目录中。如果您将 Release 文件夹中的 .exe 复制到其他位置,那么您还需要使用 .exe 复制这些 DLL。为了可移植性,我倾向于尝试使用全新安装的 Windows(未安装更新或程序)的测试虚拟机,并且我使用 Dependency Walker 逐一浏览依赖关系,直到程序愉快地运行。
This is a common problem. Also see these questions:
这是一个常见的问题。另请参阅以下问题:
Can't run a vc++, error code 0xc0150002
The application was unable to start (0xc0150002) with libcurl C++ Windows 7 VS 2010
应用程序无法使用 libcurl C++ Windows 7 VS 2010 启动 (0xc0150002)
0xc0150002 Error when trying to run VC++ libcurl
0xc0150002 尝试运行 VC++ libcurl 时出错
The application was unable to start correctly 0xc150002
The application was unable to start correctly (0*0150002) - OpenCv
应用程序无法正确启动 (0*0150002) - OpenCv
Good Luck!
祝你好运!
回答by Johri87
I faced this issue, when I was supplying the executable folder with a, by the .exe requested DLL. In my case, the DLL I supplied to the .exe was searching for another necessary DLL which was not available. The searching DLL was not capable of telling that it can not find the necessary DLL.
当我通过 .exe 请求的 DLL 为可执行文件夹提供 a 时,我遇到了这个问题。就我而言,我提供给 .exe 的 DLL 正在搜索另一个不可用的必需 DLL。正在搜索的 DLL 无法告知它找不到必要的 DLL。
You might check the DLLs you're loading and the dependencies of these DLL's.
您可以检查正在加载的 DLL 以及这些 DLL 的依赖项。
回答by Ruud van Gaal
In our case (next to trying Dependency Walker) it was a faulty manifest file, mixing 64 bits and 32 bits. We use two extra files while running in Debug mode: dbghelp.dll and Microsoft.DTfW.DHL.manifest. The manifest file looks like this:
在我们的例子中(在尝试 Dependency Walker 旁边)它是一个错误的清单文件,混合了 64 位和 32 位。在调试模式下运行时,我们使用了两个额外的文件:dbghelp.dll 和 Microsoft.DTfW.DHL.manifest。清单文件如下所示:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- $Id -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<noInheritable />
<assemblyIdentity type="win32" name="Microsoft.DTfW.DHL" version="6.11.1.404" processorArchitecture="x86" />
<file name="dbghelp.dll" />
</assembly>
Notice the 'processorArchitecture' field. It was set to "amd64" instead of "x86". It's probably not always the cause, but in our case it was the root cause, so it may be helpful to some. For 64-bit runs, you'll want "amd64" in there.
请注意“processorArchitecture”字段。它被设置为“amd64”而不是“x86”。这可能并不总是原因,但在我们的情况下,这是根本原因,因此它可能对某些人有所帮助。对于 64 位运行,您需要在其中添加“amd64”。