"The application was unable to start correctly" after including vld.h - c++

I included vld.h, vld.lib and vld_x86.dll on my Win32 project with visual studio 2010. It builds properly but when I execute, it crashes with this message:
"The application was unable to start correctly (0xc0150002). Click OK to close the application."
I run it with Dependency Walker but it shows side by side error as follows:
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.)
I have tried various ways including tinkering around with the manifest as suggested here:
https://vld.codeplex.com/discussions/360243
It only runs properly if I commented the following line on 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")
However, if I commented out that line, the vld doesn't output anything at all (just like no vld integration)
Anyone having this problem before? Any suggestions will be appreciated, thanks in advance!

I had this problem too, you need to add all these files to the same directory as your vld_x86.dll/vl_x64.dll:
Microsoft.DTfW.DHL.manifest
dbghelp.dll
Which came from the Win32/Win64 bin folder from Visual Leak Detector. Found this from: https://vld.codeplex.com/wikipage?title=Building%20Visual%20Leak%20Detector%20from%20Source

I had this problem (this error message), too. In my case the vld_x86.dll, most likely in another than the expected version, was preinstalled and registered by some other software. (everybody likes VLD, it seems) Thus, it was loaded instead of the vld_x86.dll in the path VLD was built to. Unregistering the foreign DLL solved the problem.
Hence, you might want to check the output for loading of DLLs from exotic paths.

Other might still get into the issue;
A potential fix is to install VLD version 2.5.1, can be downloaded from github: https://github.com/KindDragon/vld/releases/tag/v2.5.1
It brings the fix explained above, it includes dbghelp.dll

I got such error when I tried to run a project just after installing vld. A solution for me was re-login. Because vld installer adds new paths to PATH and VS doesn't see them without re-login. Otherwise you can use a solution with copying files dbghelp.dll and .manifest.

If you are using Visual Studio
The simplest fix if you have not been messing with your project properties in the include, linker sections is to 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 Studio projects including environment paths as well.

Related

OpenCV: Code Execution Cannot Proceed, DLLs Missing

I'm making a program using OpenCV and I need feature matching. I was previously using OpenCV3 but apparently getting SURF to work is a bit of a hassle so I switched to OpenCV2.4
I downloaded the pre-built libraries and I want to use them on Visual studio but I have a problem, when I run the program I get messages like this:
When I click ok I get more follow up messages complaining about other missing dlls. I tries re-installing but still get this error.
Here are my settings:
Under C/C++>General: Additional Include Directores:
C:\opencv2.4\opencv\build\include
Under Linker>General: Additional Library Directories:
C:\opencv2.4\opencv\build\x64\vc14\lib
C:\opencv2.4\opencv\build\x64\vc14\bin
Under Linker>Incput: Additional Dependencies:
opencv_calib3d2413.lib
opencv_contrib2413.lib
opencv_core2413.lib
opencv_features2d2413.lib
opencv_flann2413.lib
opencv_gpu2413.lib
opencv_highgui2413.lib
opencv_imgproc2413.lib
opencv_legacy2413.lib
opencv_ml2413.lib
opencv_nonfree2413.lib
opencv_objdetect2413.lib
opencv_ocl2413.lib
opencv_photo2413.lib
opencv_stitching2413.lib
opencv_superres2413.lib
opencv_ts2413.lib
opencv_video2413.lib
opencv_videostab2413.lib
I've also tried editing the Environment Variables under Path I've added the include\ bin\ and lib\ directories. I have absolutely no idea how to fix this problem. I know the dlls are there.
I copied and pasted the dlls from the bin\ directory into my solution directory and everything works fine now.
I'm not sure why adding the bin\ to the path didn't work but anyway here's the solution to that problem.
The execution program did not find the DLL.
Under "Linker>General: Additional Library Directories" it expect the path for .lib files, but the DLL are searched by the program during the executio, so in the current folder and in the PATH folders.
Put the Dll's into the execution folder or modify the PATH to add the DLL's folder (in this last case remember to restart Visual Studio).
Cheers

How can I make my application find a third-party DLL using Visual Studio?

I have read many issues regarding and followed each one but nothing seems to work.
I am trying to include the rdkafka library into my project, but every time I run the application I am getting
The program can't start because librdkafka.dll is missing from your computer.
I can clearly see that librdkafka.dll as well as librdkafka.lib exist in the same directory. I have added the include files to the project, and I have also added the librdkafka.lib to the additional directories in the Linker section. The project builds fine but it throws that error at runtime.
Does anyone know how I can solve this issue?
When in Visual Studio by default it is searching for dlls in the project directory and running the application on its own will try to find the dlls in the current working directory. Moving the dlls to this location seems to solve the issue.

Visual Studio doesn't recognize opencv: unable to locate DLL [duplicate]

I am trying just a basic program with OpenCV with the following code:
#include "cv.h"
#include "highgui.h"
int main()
{
IplImage* newImg;
newImg = cvLoadImage("~/apple.bmp", 1);
cvNamedWindow("Window", 1);
cvShowImage("Window", newImg);
cvWaitKey(0);
cvDestroyWindow("Window");
cvReleaseImage(&newImg);
return 0;
}
When I run this, I get
The program can't start because
libcxcore200.dll is missing from your
computer. Try reinstalling the
program to fix this problem.
However, I can see this DLL. It exists. I have added the following to the input dependencies for my linker
C:\OpenCV2.0\lib\libcv200.dll.a
C:\OpenCV2.0\lib\libcvaux200.dll.a
C:\OpenCV2.0\lib\libcxcore200.dll.a
C:\OpenCV2.0\lib\libhighgui200.dll.a
What gives? I'm using visual studio 2008.
When I link the .dll files instead of .dll.a files, I get
fatal error LNK1107:invalid or corrupt
file: cannot read at 0x3F8
libcv200.dll
I followed instructions on http://opencv.willowgarage.com/wiki/VisualC%2B%2B_VS2010 but was still stuck on exactly the same problem, so here's how I resolved it.
Fetched MSVC 2010 express edition.
Fetched Win 32 OpenCV 2.2 binaries and installed in default location.
Created new project.
Project setup
Project -> OpenCV_Helloworld Properties...Configuration Properties -> VC++ Directories
Include Directories... add: C:\OpenCV2.2\include\;
Library Directories... add: C:\OpenCV2.2\lib;C:\OpenCV2.2\bin;
Source Directories... add:
C:\OpenCV2.2\modules\calib3d\src;C:\OpenCV2.2\modules\contrib\src;C:\OpenCV2.2\modules\core\src;C:\OpenCV2.2\modules\features2d\src;C:\OpenCV2.2\modules\flann\src;C:\OpenCV2.2\modules\gpu\src;C:\OpenCV2.2\modules\gpu\src;C:\OpenCV2.2\modules\highgui\src;C:\OpenCV2.2\modules\imgproc\src;C:\OpenCV2.2\modules\legacy\src;C:\OpenCV2.2\modules\ml\src;C:\OpenCV2.2\modules\objdetect\src;C:\OpenCV2.2\modules\video\src;
Linker -> Input -> Additional Dependencies...
For Debug Builds... add:
opencv_calib3d220d.lib;opencv_contrib220d.lib;opencv_core220d.lib;opencv_features2d220d.lib;opencv_ffmpeg220d.lib;opencv_flann220d.lib;opencv_gpu220d.lib;opencv_highgui220d.lib;opencv_imgproc220d.lib;opencv_legacy220d.lib;opencv_ml220d.lib;opencv_objdetect220d.lib;opencv_video220d.lib;
At this point I thought I was done, but ran into the problem you described when running the exe in debug mode. The final step is obvious once you see it, select:
Linker -> General ... Set 'Use Library Dependency Inputs' to 'Yes'
Hope this helps.
Just add C:\OpenCV2.0\bin into your PATH environment variable
or
When you install OpenCV,
Choose the option, Add OpenCV to the system PATH for current user which is not default one
Just for your information,after add the "PATH",for my win7 i need to reboot it to get it work.
In Visual Studio 2013 you need to add this to the Environment Variables and then Restart your pc. This is the path where .dll file located in.
I have had numerous problems with opencv and only succeded after a gruesome 4-6 months. This is the last problem I have had, but all of the above didn't work. What worked for me was just copying and pasting the opencv_core2*.dll (and opencv_highgui2*.dll which it will ask for since you included this as well) into the release (or debug folder - I'm assuming. Haven't tested this) folder of your project, where your application file is.
Hope this helps!
You just need to add the folder of the needed dll file (or files) to your system "Environment Variables" in "Path".
Your problem will 100% be resolved. I had this problem too.
just open the bin folder and copy and paste the .dll files to the folder you are working in..it should fix the problem
As to #Marc's answer, I don't think VC uses the path from the OS. Did you add the path to VC's library paths. I usually add the DLLs to the project and copy if newer on the build and that works very well for me.
you can find the opencv_core248 and other dlls in opencv\build\x86\vc12\bin folder. Just copy the dlls you require into system32 folder. And your app should start working in a flash ! Hope it helps.
This might be like resurrecting a dead horse. But just so it's out there, the reason why the answer to these types of questions to simply put dll's into the system32 folder is because that folder is in the os's system path.
It's actually best practice to provide the os with a path link.
With windows 10
open up file explorer
right click on "this pc" and select "properties"
Now in the "Control Panel\System and Security\System" window that comes up, click on "Advanced System Settings" from the left hand panel.
At the bottom of the next window, click on the "Environment Variables" button.
On the next window, there are two panels, the top one is for modifying variables to the current user, and the bottom panel is for modifying variables to the system. On the bottom panel, find the variable "Path" and click it to select it, then click on the "edit" button.
Here you can then create, edit, delete, or update the different paths for the system. For example, to add mingw32-make to the system so you can access that command via command prompt, click new, then paste in the path to the bin. Example path, "D:\Qt\Tools\mingw730_64\bin", no quotation marks nor additional whitespaces.
Click ok on all the windows so that the changes are saved, then reboot your computer for the changes to be loaded.
The ".a" at the end of your DLL files is a problem, and those are there because you didn't use CMAKE to build OpenCV 2.0. Additionally you do not link to the DLL files, you link to the library files, and again, the reason you do not see the correct library files is because you didn't use CMAKE to build OpenCV 2.0. If you want to use OpenCV 2.0 you must build it for it to work correctly in Visual Studio. If you do not want to build it then I would suggest downgrading to OpenCV 1.1pre, it comes pre-built and is much more forgiving in Visual Studio.
Another option (and the one I would recommend) is to abandon OpenCV and go with EmguCV. I have been playing with OpenCV for about a year and things got much easier when I switched to EmguCV because EmguCV works with .NET, so you can use a language like C# that does not come with all the C++ baggage of pointers, header files, and memory allocation problem.
And as for the question of 64bit vs. 32bit, OpenCV does not officially support 64bit. To be on the safe side open your project properties and change the "Platform Target" under the "Build" tab from "Any CPU" to "X86". This should be done any time you do anything with OpenCV, even if you are using a wrapper like EmguCV.
Copy all .dll from /bin in System32
Just copy the .dll files to C:\windows\system32\
No need to do any of that. It is a visual studio error.
just go here:
http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=31354
and download the appropriate fix for your computer's OS
close visual studio, run the fix and then restart VS
The code should run without any error.

Application error - debug exe wont run

I've recently downloaded Assimp and I've run into some troubles.
I've linked the libraries and I can get the program to compile and it runs fine in Release mode; however, the Debug .exe hits me with this error:
The application was unable to start correctly (0xc0150002). Click OK to close the application.
Some more details:
I'm using VS2010 with Target Machine set to x86.
I am using the 32bit debug dll (Assimp32d.dll) that was provided, and I've tried setting runtime libraries to /MT, /MTd, /MD, and /MDd with no luck.
I read from other similar threads that I should run Dependency Walker on the .exe, but I'm not sure what the output means. I'll paste it here if this helps you guys.
Error: The Side-by-Side configuration information for "c:\users\-----\documents\visual studio 2010\projects\AssimpTest\debug\ASSIMP32D.DLL" contains errors. The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail (14001).
Error: At least one required implicit or forwarded dependency was not found.
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: Modules with different CPU types were found.
Rather than rebuilding the libraries, I downloaded a different set of libraries (it was the SDK installer) and the debug dll's from that are working perfectly.
Just in case anyone has the same problem with the same software, this was the exact name of the installer that worked for me: assimp-sdk-3.0-setup.exe
I ran into the same problem when trying to run a 64-bit project in Debug mode when using Assimp 3.0.
What I did was go to assimp/workspaces/vc9, open assimp.sln in Visual Studio 10, convert the project, then rebuild the 32 and 64-bit dll.
Mind you, you've got to install boost for that as well, and edit the project properties so it points to the boost directory for includes.
There's probably a way to do it using CMake as well, but I found the whole process too cumbersome to bother with in the first place.
My solution was just to link the debug build to the release .dll files. No more issues, and I wasn't that interested in debugging the Assimp library anyway!
I faced the same issue, later on I downloaded the "assimp-sdk-3.0-setup.exe" file & installed it as a standard windows application.
I pointed Visual Studio Solution Include & Lib directories to respective folders from newly installed location, copied DLL to my application location. The problem was resolved. Hope this helps someone.
Cheers.

C++ - unable to start correctly (0xc0150002)

I'm trying to run an OpenCV application through Microsoft Visual C++ 2010 Express, and get the following message:
How can I solve this issue?
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:
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")
Alternatively, try loading the executable into Dependency Walker ( http://www.dependencywalker.com/ ), it should point out the missing dlls for you.
In my case, Visual Leak Detector I 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 Detector all 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.
I take it that is a Vista Window! I often got this when first trying to port a DirectX program from XPsp3 to 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)
This error is also caused by incorrect installation of .dlls (i.e not rolling out)
hth
Happy hunting
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.
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.
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 include 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.
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=0xc0150002 one 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.
It is because there is a DLL that your program is missing or can't find.
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.
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)
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.
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
0xc0150002 Error when trying to run VC++ libcurl
The application was unable to start correctly 0xc150002
The application was unable to start correctly (0*0150002) - OpenCv
Good Luck!
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:
<?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.
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.
You might check the DLLs you're loading and the dependencies of these DLL's.
Here is my solution for this error:
(The Application was unable to start correctly (OXO15OOO20).Click to close the application).
From the Start menu, click Administrative Tools, and then click Windows Server Backup.
Click File, Click Option, and then in Disk Cleanup press Delete files and then press O.K,
and delete till it reaches to 0 byete
No Worry About it just it deletes the amount of disk space on your computer.