Reputation: 2963
I wrote a simple test program for opencv to see if it's working after I compiled my OpenCV 2.4 in visual studio 2010 pro.
The program goes like this:
#include "StdAfx.h"
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{
Mat im = imread("c:/full/path/to/lena.jpg");
if (im.empty())
{
cout << "Cannot load image!" << endl;
return -1;
}
imshow("Image", im);
waitKey(0);
}
The thing is that the program compiles without problems ( I've set all the lib paths and include paths in visual studio), but when I try to run it, it gives me the following error message winow: "The program can't start because opencv_core240d.dll is missing from your computer. Try reinstalling the program to fix this problem"
Now, I've read that this could be solved by setting the windows PATH variable to the directory where the actual .dll file is located by doing a cmd command:
SET PATH="C:\Program Files (x86)\OpenCV\opencv\build\bin\Debug"
The path specified is indeed the path where the .dll file is located however, I still get the error.
Help would really be appreciated since I've spent far too much time cocking around this...
Upvotes: 1
Views: 2437
Reputation: 28762
You will have to run your program from the same command line from where you set the PATH(after setting the path, of course).
If you are trying to run it from some other place, you should set the PATH env. variable in the Control Panel -> System first(*), then restart your command line/IDE to have the new PATH in effect
(*) Control Panel -> System -> Advanced System Settings -> Environment Variables on Windows 7
Upvotes: 4