C++ – “The program can’t start because opencv_world300.dll is missing from your computer” error in C++

copencvvisual-studio-2013

I want to compile an opencv Console C++ program in Visual Studio 2013. This is my code:

#include "stdafx.h"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>

using namespace cv;
using namespace std;

int main(int argc, const char** argv)
{
    Mat img = imread("rgb_1.png", CV_LOAD_IMAGE_UNCHANGED); //read the image data in the file "MyPic.JPG" and store it in 'img'

    if (img.empty()) //check whether the image is loaded or not
    {
        cout << "Error : Image cannot be loaded..!!" << endl;
        //system("pause"); //wait for a key press
        return -1;
    }

    namedWindow("MyWindow", CV_WINDOW_AUTOSIZE); //create a window with the name "MyWindow"
    imshow("MyWindow", img); //display the image which is stored in the 'img' in the "MyWindow" window

    waitKey(0); //wait infinite time for a keypress

    destroyWindow("MyWindow"); //destroy the window with the name, "MyWindow"

    return 0;
}

Although I have defined all the directories in properties both in Computer and Visual Studio directories, I get the following error:

"The program can't start because opencv_world300.dll is missing from your computer."

How can I fix this problem?

Best Answer

Under windows you can copy it from:

<your install directory>\opencv30\build\x64\vc12\bin

And put it in your Visual Studio solution (I assume you are using a x64/Release configuration):

<your solution directory>\x64\Release

Or you you can add the above OpenCV to your PATH environment variable

Related Topic