2

I'm trying to setup a small framework for opencv 2.3.x with the mingw compiler in Code::Blocks.

I want the framework to be moved from computer to computer (multiple developers) - something like a micro version of openFrameworks.

What I have done now is to setup my directory tree like this:

- root
- - Datafiles
- - Libraries
- - - OpenCV
- - - - bin
- - - - lib
- - - - include
- - Projects
- - - OpenCV_HelloWorld
- - - - OpenCV_HelloWorld.cbp

Because of the move-ability, I want to define the path to the lib and include folder relatively. I have setup the following Build Options for my Code::Blocks project:

Build Options -> Debug -> Search directories -> Compiler:

..\..\Libraries\OpenCV\include

Build Options -> Debug -> Search directories -> Linker:

..\..\Libraries\OpenCV\lib

Build Options -> Debug -> Linker settings -> Link libraries:

..\..\Libraries\OpenCV\lib\libopencv_calib3d231.dll.a
..\..\Libraries\OpenCV\lib\libopencv_contrib231.dll.a
..\..\Libraries\OpenCV\lib\libopencv_core231.dll.a
..\..\Libraries\OpenCV\lib\libopencv_features2d231.dll.a
..\..\Libraries\OpenCV\lib\libopencv_flann231.dll.a
..\..\Libraries\OpenCV\lib\libopencv_gpu231.dll.a
..\..\Libraries\OpenCV\lib\libopencv_highgui231.dll.a
..\..\Libraries\OpenCV\lib\libopencv_imgproc231.dll.a
..\..\Libraries\OpenCV\lib\libopencv_legacy231.dll.a
..\..\Libraries\OpenCV\lib\libopencv_ml231.dll.a
..\..\Libraries\OpenCV\lib\libopencv_objdetect231.dll.a
..\..\Libraries\OpenCV\lib\libopencv_video231.dll.a

When I compile this hello world sample:

#include <iostream>
#include "opencv\cv.h"
#include "opencv\highgui.h"

using namespace std;

int main()
{
    cout << "Hello world!" << endl;
    return 0;
}

I get this error:

..\..\Libraries\OpenCV\include\opencv\cv.h|63|error: opencv2/core/core_c.h: No such file or directory|

What have I done wrong? What more do I need to include? Is there a easier way to to this?

Thank you all in advance

hansdam
  • 127
  • 3
  • 11

1 Answers1

2

After some research I found an answer to my question.

In the prebuild opencv 2.3.1 library I found that the "includes" folder does not contain all the header files in the "opencv2" folder.

These include files can be found in the "modules" folder. Therefore you need to add these search directories to your project folder.

Another way of solving the problem, was to follow a guide on the opencv website, in order to build the library myself with cmake. When this is done, the include folder contains all the header files needed, in the correct location.

Problem solved!

hansdam
  • 127
  • 3
  • 11