Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Monday, April 18, 2016

Why can't my c++ program find the necessary .dll file?

Why can't my c++ program find the necessary .dll file?


I am trying to use OpenCV (a computer vision library), which appearently uses a few .dll files, located in C:\OpenCV\bin (which has been added to the system PATH variable). However, if I try to run a simple test program, it gives a system error:

The program can't start because highgui.dll is missing from your computer. Try reinstalling the program to fix this problem.

If I copy the highgui.dll file into the system32 folder, it works, but I don't want to have to put all the necessary .dll files in the system32 folder.

Does anyone know why the .dll file can't be found or what I should do to fix it?
(I already checked all paths in the PATH variable for validity.)

Answer by Chris for Why can't my c++ program find the necessary .dll file?


Have you tried copying highgui.dll into your build folder. As it is dynamically linked your program will look locally to find it and if it is not being copied into your build directory it won't be able to find it.

Answer by Michael Burr for Why can't my c++ program find the necessary .dll file?


How is the program being launched and how is the PATH variable being updated?

If you update the path in a command window, but launch the app from your IDE or from the Windows desktop, the environment for the launched process will probably have a different PATH setting than the environment for your command window.

Similarly if you change the PATH in the

System Control Panel applet, it might not have an effect on an IDE or command window that was launched before you made the PATH edit.

Answer by RemiX for Why can't my c++ program find the necessary .dll file?


I tracked down the executable that was built by Netbeans before running and launched it, and it gave no errors (so Netbeans probably uses its own paths for executing), so tried to find out how I could make Netbeans search the right paths for the DLLs, and after adding an environment variable PATH=C:/OpenCV2.1/bin (Project Properties > Run > Environment), the program ran correctly!
I do hope this is not some sort of hack that 'acdidentally' solves my problem while creating worse side-effects...
Thanks for the help!

Answer by Sayak for Why can't my c++ program find the necessary .dll file?


I am using OpenCV 2.2 with Visual Studio 10. to create a new project i do the following steps... 1.VC++ Directories -> Include Directories -> C:\OpenCV2.2\include Library Directories -> C:\OpenCV2.2\lib 2.C/C++ -> General -> Additional Include Directories ->C:\OpenCV2.2\bin 3.Linker -> Input -> opencv_core220.lib;opencv_highgui220.lib;opencv_calib3d220.lib;opencv_contrib220.lib;opencv_features2d220.lib;opencv_ffmpeg220.lib;opencv_flann220.lib;opencv_gpu220.lib;opencv_imgproc220.lib;opencv_legacy220.lib;opencv_ml220.lib;opencv_objdetect220.lib;opencv_ts220.lib;opencv_video220.lib;

  1. i copy all the dll files to the project debug folder. it gives me no hitch and everything is fine..

Answer by knr7201 for Why can't my c++ program find the necessary .dll file?


I had this problem using Visual Studio 12 and after checking to make sure I had no typos in my PATH for the tenth time, I noticed there was a space after the semi-colon from the previous path. I removed it and Visual Studio was able to find the DLLs I needed.

If you have multiple paths stored in your PATH variable, make sure they are separated by semi-colons with no spaces.


Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72

Related Posts:

0 comments:

Post a Comment

Popular Posts

Fun Page

Powered by Blogger.