包含vld.h后,“应用程序无法正确启动”

时间:2013-10-07 02:46:29

标签: c++ visual-studio-2010 memory-leaks visual-leak-detector

我在Visual Studio 2010的Win32项目中包含了vld.h,vld.lib和vld_x86.dll。它构建正确,但是当我执行时,它会崩溃并显示以下消息:

"The application was unable  to start correctly (0xc0150002). Click OK to close the application."

我使用Dependency Walker运行它,但它显示并排错误如下:

Error: The Side-by-Side configuration information for "D:\project\..\debug\VLD_X86.DLL" contains errors. The application has failed to start because its side-by-side configuration is incorrect.)

我尝试了各种方法,包括修改清单,如下所示:

https://vld.codeplex.com/discussions/360243

如果我在vld.h上注释了以下行,它只能正常运行

// Force a symbolic reference to the global VisualLeakDetector class object from
// the DLL. This ensures that the DLL is loaded and linked with the program,
// even if no code otherwise imports any of the DLL's exports.
//#pragma comment(linker, "/include:__imp_?g_vld@@3VVisualLeakDetector@@A")

但是,如果我注释掉那一行,那么vld根本不输出任何内容(就像没有vld集成一样)

以前有过这个问题的人吗?任何建议将不胜感激,提前谢谢!

5 个答案:

答案 0 :(得分:23)

我也有这个问题,你需要将所有这些文件添加到 vld_x86.dll / vl_x64.dll 所在的目录中:

<强> Microsoft.DTfW.DHL.manifest

<强> dbghelp.dll

来自Visual Leak Detector的Win32 / Win64 bin文件夹。发现于:https://vld.codeplex.com/wikipage?title=Building%20Visual%20Leak%20Detector%20from%20Source

答案 1 :(得分:2)

我也有这个问题(这个错误信息)。在我的情况下,vld_x86.dll(很可能是在预期版本之外的其他版本)是由其他软件预安装和注册的。 (似乎每个人都喜欢VLD)因此,在VLD构建的路径中加载了它而不是vld_x86.dll。取消注册外部DLL解决了这个问题。

因此,您可能需要检查输出以从异常路径加载DLL。

答案 2 :(得分:0)

IF YOU ARE USING VISUAL STUDIOS: -The simplest fix if you have not been messing with your project properties in the include, linker sections make sure that you did not manually add VLD. Instead clear the includes you made in here and save your project. -Close it then install the latest VLD and it will automatically create the includes parent inheritance for your visual studios projects including environment paths as well.

答案 3 :(得分:0)

其他人可能仍然会遇到问题;
潜在的修复方法是安装VLD 2.5.1版,可以从github下载:https://github.com/KindDragon/vld/releases/tag/v2.5.1

它带来了上面说明的修复程序,其中包括dbghelp.dll

答案 4 :(得分:0)

在安装vld之后尝试运行项目时出现了此类错误。对我来说,一个解决方案是重新登录。因为vld安装程序将新路径添加到PATH,而VS如果不重新登录就看不到它们。否则,您可以使用复制文件dbghelp.dll和.manifest的解决方案。