1
votes

The issue is that OpenCV has not been setup properly to run a simple "Hello World" type of program.

Running: Windows 8, 64 bit

IDE: CodeBlocks 13.12

OpenCV: 2.4.10

Actions Taken


  • Downloaded OpenCV
  • Binaries were built with CMake (followed basics steps of this tutorial: http://kevinhughes.ca/tutorials/opencv-install-on-windows-with-codeblocks-and-mingw/)
  • Set PATH for Environment Variables to C:\opencv\build\x64\mingw\bin;C:\MinGW\bin
  • Set Link libraries to all contained in C:\opencv\build\x64\mingw\lib
    * Note * The files' type was .dll.a not .dll
  • Set Search directories Compiler to C:\opencv\build\include
  • Set Search directories Linker to C:\opencv\build\x86\mingw\lib
  • Copied code from OpenCV tutorial to test proper configuration

'

   #include <opencv2/core/core.hpp>
   #include <opencv2/highgui/highgui.hpp>

    using namespace cv;

    int main()
   {
    Mat image;// new blank image
    image = cv::imread("test.png", 0);// read the file
    namedWindow( "Display window", CV_WINDOW_AUTOSIZE );// create a window for display.
    imshow( "Display window", image );// show our image inside it.
    waitKey(0);// wait for a keystroke in the window
    return 0; 
    }'
  • Built and Ran
  • Got the following System Error

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

What could be wrong with the configuration?

2
Copy the DLLs to the directory where your exe is. - sashoalm
Find where in the directory with MinGW the «libopencv_core2410.dll» file, and either add the path to $PATH, either add in the project to link paths. - Hi-Angel
@sashoalm, terrible idea. totally defeats "shared libs" - berak
@berak Well, that's kind of the way on Windows. You really think anyone will just hope the DLL happens to be on the client's machine? Every program just places the DLLs in the exe's directory, go look in C:\Program Files. This is not UNIX. - sashoalm

2 Answers

2
votes

The configuration of Code::Blocks is okay since you managed to build and run.

The DLL directory needs to be in the PATH, or else the DLL needs to be in the same directory as the executable.

You can just copy it there, but I'd add it to the PATH variable.

Command sysdm.cpl to run the System applet. In Advanced tab press button "Environment variables..." at bottom. Add or edit PATH in user environment defaults.

Restart Code::Blocks.

0
votes

Simply you should set the DLL file in the path variable like C:\opencv\my_build\install\x64\mingw\lib\libopencv_core2411.dll.a here my_build is a directory in which i make all library as you write in post.