Author Topic: Problem with opencv library (fatal error : No such file or directory)  (Read 23772 times)

Offline Zekk

  • Single posting newcomer
  • *
  • Posts: 9
Re: Problem with opencv library (fatal error : No such file or directory)
« Reply #15 on: June 29, 2013, 05:20:49 pm »
scarphin :

Yes I perform all the steps listed in the website (so I made modifcations in 'settings ->compiler ->search directories' and 'settings ->compiler ->Linker settings'.

I tried to do the same thing in  'project->build options-> search directories' and  'project->build options->Linker settings', but it's still not working.

In 'settings ->compiler ->search directories ->compiler' I have :

Code: [Select]
C:\opencv\include
And in 'settings ->compiler ->search directories ->Linker' :

Code: [Select]
C:\opencv\build\x86\mingw\lib


stahta01 :

I don't understand why, I configured my computer to compile with :

Code: [Select]
c:/program files (x86)/codeblocks/mingw/bin/
« Last Edit: June 29, 2013, 05:22:45 pm by Zekk »

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Problem with opencv library (fatal error : No such file or directory)
« Reply #16 on: June 29, 2013, 06:13:16 pm »
You said you added 'C:\opencv\build\include' but now you say you have 'C:\opencv\include'! Which one is correct?

Do you have a 'C:\opencv\build\include\opencv2\imgproc\imgproc.hpp' file or a 'C:\opencv\build\include\opencv2\imgproc\imgproc.hpp' file? Be careful with the paths!

Also set your paths in the project settings not global compiler settings. Global compiler settings are for every project where project options are just for the current project.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5251
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Problem with opencv library (fatal error : No such file or directory)
« Reply #17 on: June 29, 2013, 06:25:07 pm »
@Zekk
The official OpenCV release binaries (including 32 bit mingw libs) was build from Official MinGW GCC 4.6.1. So, even you fix the header file issue(I don't think it is hard to fix this issue :)), you will still meet another issue: libraries version mismatch. You should use the same GCC compiler to build your apps, in this case, you should install an Official MinGW GCC 4.6.1. (See which mingw compiler is used to create the pre-build libs in 2.4.3 release for OpenCV devs answers)

The other alternative is: build OpenCV library under TDM GCC 4.7.1 and build your OpenCV app with TDM GCC 4.7.1.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Zekk

  • Single posting newcomer
  • *
  • Posts: 9
Re: Problem with opencv library (fatal error : No such file or directory)
« Reply #18 on: June 30, 2013, 08:10:20 am »
scarphin :

In the website, they said  : add 'C:\opencv\include'. I tried to change with 'C:\opencv\build\include' but nothing change.

So now, I have 'C:\opencv\include'.


ollydbg :

I installed the Official MinGW GCC 4.6.1 (with your link). I generate my opencv library in my project file, but the problem still remain.

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Problem with opencv library (fatal error : No such file or directory)
« Reply #19 on: June 30, 2013, 11:06:24 am »
scarphin :

In the website, they said  : add 'C:\opencv\include'. I tried to change with 'C:\opencv\build\include' but nothing change.

So now, I have 'C:\opencv\include'.

You must be joking! Do you really think that the compiler will find a nonexistent file just because it is written on some tutorial?!?

Ok, last advice. Make sure your opencv path, 'C:\opencv\include' or 'C:\opencv\build\include'. Add the CORRECT PATH (THE ONE ON YOUR COMPUTER NOT THE TUTORIAL) to 'project->build options->search directories->compiler' for TOP LEVEL. And then include your 'imgproc.hpp' file with
Code: [Select]
#include <opencv2/imgproc/imgproc.hpp>
If you still get the same error then you are missing some steps. Loop through them again.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5251
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Problem with opencv library (fatal error : No such file or directory)
« Reply #20 on: July 01, 2013, 03:49:28 pm »
ollydbg :
...I generate my opencv library in my project file, but the problem still remain.
How do you generate your opencv library?
What's the remaining problem? I don't know. Tell us the full build logs and minimal sample code and steps to reproduce this problem.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.