views:

246

answers:

3

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.)

A: 

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.

Chris
I'm using Netbeans, but I don't see a build folder in the project (sorry, I'm not quite familiar with builds etc). However, isn't it strange that the way OpenCV is installed (with a Windows Installer), it does not work yet? Would it still require moving files to different locations?
RemiX
A: 

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.

Michael Burr
The bin directory of OpenCV was added during installation of OpenCV. Then I wrote a simple program in Netbeans and launched it. So the PATH variable is set before launch.
RemiX
Just to be clear - was Netbeans launched after OpenCV was installed?
Michael Burr
A: 

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!

RemiX