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

1
  • codeblocks has a project wizard for creating opencv project, you can try it. Commented Aug 11, 2018 at 7:43

1 Answer 1

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!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.