0

I am a beginner learning OpenCV. I have the latest version (2.4.7.2 as of Dec, 2013) and am trying a simple code to load image. The code is OK, but when I compiled and then run the source code, it says that "the program can't start because opencv_core247d.dll is missing."

I already tried changing the computer's environment and making all the corresponding path setting for my solution according to several suggestions. I tried rebooting the PC, adding the "missing file" to my source code's Debug file, tried getting around with CMake (fortunately though it failed to generate anything and I guess that goes for my next question); the problem persists.

So, is there any fool-proof and simple way of dealing with this problem? Thank you. Btw, here is my little source code:


# include "highgui.h"

int main (int argc, char** argv)
{

    IplImage* img = cvLoadImage("D:\\OpenCV Test\\LoadImage\\fruits.jpg") ;
    cvNamedWindow("Fuits", CV_WINDOW_AUTOSIZE) ;
    cvShowImage("Fuits", img) ;
    cvWaitKey(0) ;
    cvDestroyWindow("Fruits") ;
    cvReleaseImage (&img) ;
}

herohuyongtao
  • 49,413
  • 29
  • 133
  • 174
Megacephalo
  • 11
  • 1
  • 5

4 Answers4

1

You are running into OpenCV dll issues, similar to here. Three ways to fix dll-related issues about OpenCV, also works for other dll related issues.

  1. copy the required dlls into the same folder with your application. This is a little better because it kind of prepares you for when you'll need to deploy your application on systems that don't have OpenCV installed (for then don't forget to build the release version of your application).

  2. add the dll path to Debugging Environment: Project –> Properties –> Configuration Properties –> Debugging –> Environment –> add dlls' paths here. The syntax is NAME=VALUE and macros can be used (for example, $(OutDir).

    • For example, to prepend C:\Windows\Temp to the PATH: PATH=C:\WINDOWS\Temp;%PATH%

    • Similarly, to append $(SolutionDir)\DLLS to the PATH: PATH=%PATH%;$(SolutionDir)\DLLS

  3. add the dll path to Environment Variables (be careful that the path in there are separated by ;)


EDIT: Among the three methods, the first two will only work for this project (local) and the last one works for all projects in your PC (global).

Community
  • 1
  • 1
herohuyongtao
  • 49,413
  • 29
  • 133
  • 174
1

i have problem . i have win7-64bit and visual studio 2013 and opencv-3

the program can't start because opencv_word300d.dll is missing from your computer . try reinstalling the program to fix problem.

  • You probably need to copy this dll in the same folder as where Visual studio is putting the final exe, or you could add it to windows system folders (not recommended). The dll can probably be found in opencv-3 folders ... if not then you probably need to compile it yourself from opencv sources – VB_overflow Aug 28 '15 at 15:12
1

As a tip make sure the last three digits in your linker contain the same numbers as your actual dll files. Ex: version 3.2.0 should be written 320.dll and so on

  • 1
    This would be a very nice comment. But as an answer its probably a bit thin IMHO... Welcome to stackoverflow. Please read How [how to answer](https://stackoverflow.com/help/how-to-answer). – Axel Aug 31 '17 at 22:32
0

Make sure your environment variables are set properly (i.e., Path should have ../opencv/bin/) and then use these lines in your CMakeList file to generate the appropriate project files.

FIND_PACKAGE( OpenCV REQUIRED )
TARGET_LINK_LIBRARIES( myProject ${OpenCV_LIBS} )
scap3y
  • 1,188
  • 10
  • 27