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

Offline Zekk

  • Single posting newcomer
  • *
  • Posts: 9
Hello everyone,

I want to use opencv library (v.2.4.5) with C::B (v.12.11) I have followed the instruction bellow (http://opencv.willowgarage.com/wiki/CodeBlocks), and I also set the PATH variable environnement on this adress : C:\opencv\bluid\x86\mingw\bin (my opencv library was extract in C:\).

But when I try to test a sample program like  "demhist" in the folder "C:\OpenCV\samples\cpp\demhist.cpp", I have the following message : fatal error : imgproc.hpp : No such file or directory

I'm looking for a solution since yesterday but I can't find anything.

Do you have any suggestions ?
« Last Edit: June 28, 2013, 02:06:58 pm by Zekk »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2590
have you done step 3 to 6?

Offline Zekk

  • Single posting newcomer
  • *
  • Posts: 9
yes, I even try to uninstall/reinstall Code Blocks and restart the steps

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2590
search for the  improc.hpp  and add the the path to the search directories....

Offline Zekk

  • Single posting newcomer
  • *
  • Posts: 9
They are two files  imgproc.hpp.

The first is in C:\opencv\build\include (I already add this one)
The second is in C:\opencv\module

Even if I add the  adress in Search directories (Compiler), it's still not work
« Last Edit: June 28, 2013, 02:07:22 pm by Zekk »

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
How do you include 'improc.hpp'?

Code: [Select]
<improc.hpp>
or

Code: [Select]
<opencv2/improc/improc.hpp>

Offline Zekk

  • Single posting newcomer
  • *
  • Posts: 9
I include 'imgproc.hpp' with :

 <imgproc.hpp>

I already try with

<opencv2/imgproc/imgproc.hpp>

but it doesn't work.
« Last Edit: June 28, 2013, 02:05:23 pm by Zekk »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2590
Did you made a project, or did you loaded only the source file?

try to: Project->Build options->Other Options, add there a -v and rebuild. Then post the FULL BUILD LOG, from the "Build Log" tab here.

greetings

Offline Zekk

  • Single posting newcomer
  • *
  • Posts: 9
Here the message :

Code: [Select]
-------------- Build: Debug in test_opencv (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -fexceptions  -g -v    -IC:\opencv\include -IC:\opencv\modules -IC:\opencv\build\include  -c C:\Users\Clems\Documents\Programmation\test_opencv\main.cpp -o obj\Debug\main.o
Using built-in specs.
COLLECT_GCC=mingw32-g++.exe
Target: mingw32
Configured with: ../../src/gcc-4.7.1/configure --build=mingw32 --enable-languages=c,c++,ada,fortran,objc,obj-c++ --enable-threads=win32 --enable-libgomp --enable-lto --enable-fully-dynamic-string --enable-libstdcxx-debug --enable-version-specific-runtime-libs --with-gnu-ld --disable-nls --disable-win32-registry --disable-symvers --disable-build-poststage1-with-cxx --disable-werror --prefix=/mingw32tdm --with-local-prefix=/mingw32tdm --enable-cxx-flags='-fno-function-sections -fno-data-sections' --with-pkgversion=tdm-1 --enable-sjlj-exceptions --with-bugurl=http://tdm-gcc.tdragon.net/bugs
Thread model: win32
gcc version 4.7.1 (tdm-1)
COLLECT_GCC_OPTIONS='-Wall' '-fexceptions' '-g' '-v' '-I' 'C:\opencv\include' '-I' 'C:\opencv\modules' '-I' 'C:\opencv\build\include' '-c' '-o' 'obj\Debug\main.o' '-mtune=i386' '-march=i386'
 c:/program files (x86)/codeblocks/mingw/bin/../libexec/gcc/mingw32/4.7.1/cc1plus.exe -quiet -v -I C:\opencv\include -I C:\opencv\modules -I C:\opencv\build\include -iprefix c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/ C:\Users\Clems\Documents\Programmation\test_opencv\main.cpp -quiet -dumpbase main.cpp -mtune=i386 -march=i386 -auxbase-strip obj\Debug\main.o -g -Wall -version -fexceptions -o C:\Users\Clems\AppData\Local\Temp\ccIFFwHz.s
GNU C++ (tdm-1) version 4.7.1 (mingw32)
compiled by GNU C version 4.7.1, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/../../../../mingw32/include"
ignoring duplicate directory "c:/program files (x86)/codeblocks/mingw/lib/gcc/../../lib/gcc/mingw32/4.7.1/include/c++"
ignoring duplicate directory "c:/program files (x86)/codeblocks/mingw/lib/gcc/../../lib/gcc/mingw32/4.7.1/include/c++/mingw32"
ignoring duplicate directory "c:/program files (x86)/codeblocks/mingw/lib/gcc/../../lib/gcc/mingw32/4.7.1/include/c++/backward"
ignoring duplicate directory "c:/program files (x86)/codeblocks/mingw/lib/gcc/../../lib/gcc/mingw32/4.7.1/include"
ignoring duplicate directory "c:/program files (x86)/codeblocks/mingw/lib/gcc/../../lib/gcc/mingw32/4.7.1/../../../../include"
ignoring duplicate directory "c:/program files (x86)/codeblocks/mingw/lib/gcc/../../lib/gcc/mingw32/4.7.1/include-fixed"
ignoring nonexistent directory "c:/program files (x86)/codeblocks/mingw/lib/gcc/../../lib/gcc/mingw32/4.7.1/../../../../mingw32/include"
#include "..." search starts here:
#include <...> search starts here:
 C:\opencv\include
 C:\opencv\modules
 C:\opencv\build\include
 c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/include/c++
 c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/include/c++/mingw32
 c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/include/c++/backward
 c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/include
 c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/../../../../include
 c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.7.1/include-fixed
End of search list.
GNU C++ (tdm-1) version 4.7.1 (mingw32)
compiled by GNU C version 4.7.1, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 1b05afeca9d712f769248af52f554d5e
C:\Users\Clems\Documents\Programmation\test_opencv\main.cpp:9:23: fatal error: imgproc.hpp: No such file or directory
compilation terminated.
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings (0 minutes, 0 seconds)

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2590
Code: [Select]
C:\Users\Clems\Documents\Programmation\test_opencv\main.cpp:9:23: fatal error: imgproc.hpp: No such file or directory
so, is this header called "imgproc.hpp" or "improc.hpp"

check your typo....

Offline Zekk

  • Single posting newcomer
  • *
  • Posts: 9
Re: Problem with opencv library (fatal error : No such file or directory)
« Reply #10 on: June 28, 2013, 02:12:09 pm »
Ho ok, I'm sorry ... wrong writing. I corrected my previous topics : the right name is "imgproc.hpp"  as you said (but problem remain the same).

Sorry for that.
« Last Edit: June 28, 2013, 02:13:49 pm by Zekk »

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Problem with opencv library (fatal error : No such file or directory)
« Reply #11 on: June 28, 2013, 03:44:47 pm »
What directories do you have in your 'project->build options-> search directories->compiler' for top level?

Offline Zekk

  • Single posting newcomer
  • *
  • Posts: 9
Re: Problem with opencv library (fatal error : No such file or directory)
« Reply #12 on: June 28, 2013, 05:00:32 pm »
I have nothing.

When I read your anwser, I try to add in  'project->build options-> search directories'  the same things than in 'settings ->compiler ->search directories', but I still have the same error.

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: Problem with opencv library (fatal error : No such file or directory)
« Reply #13 on: June 28, 2013, 11:22:12 pm »
Did you actually performed the steps in http://opencv.willowgarage.com/wiki/CodeBlocks? Because if you did you would have your search dirs in 'project->build options-> search directories->compiler'!

And again, what directories do you have in 'settings ->compiler ->search directories' or wherever you have them?

Online stahta01

  • Lives here!
  • ****
  • Posts: 6789
    • My Best Post
Re: Problem with opencv library (fatal error : No such file or directory)
« Reply #14 on: June 29, 2013, 01:02:49 am »
Please decide what MinGW GCC you are trying to use!
Then, tell us which one you are trying to use?

You appear to be trying to use two different MinGW GCC in a single project this will NOT work!!!

One of them.
Code: [Select]
C:\opencv\bluid\x86\mingw\bin

The othe one.
Code: [Select]
c:/program files (x86)/codeblocks/mingw/bin/

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

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.