Code::Blocks Forums

User forums => Help => Topic started by: Zekk on June 28, 2013, 07:48:32 am

Title: Problem with opencv library (fatal error : No such file or directory)
Post by: Zekk on June 28, 2013, 07:48:32 am
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 ?
Title: Re: Problem with opencv library (fatal error : No such file or directory)
Post by: BlueHazzard on June 28, 2013, 09:04:31 am
have you done step 3 to 6?
Title: Re: Problem with opencv library (fatal error : No such file or directory)
Post by: Zekk on June 28, 2013, 09:17:34 am
yes, I even try to uninstall/reinstall Code Blocks and restart the steps
Title: Re: Problem with opencv library (fatal error : No such file or directory)
Post by: BlueHazzard on June 28, 2013, 09:39:37 am
search for the  improc.hpp  and add the the path to the search directories....
Title: Re: Problem with opencv library (fatal error : No such file or directory)
Post by: Zekk on June 28, 2013, 10:16:10 am
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
Title: Re: Problem with opencv library (fatal error : No such file or directory)
Post by: scarphin on June 28, 2013, 10:20:40 am
How do you include 'improc.hpp'?

Code
<improc.hpp>

or

Code
<opencv2/improc/improc.hpp>
Title: Re: Problem with opencv library (fatal error : No such file or directory)
Post by: Zekk on June 28, 2013, 10:25:35 am
I include 'imgproc.hpp' with :

 <imgproc.hpp>

I already try with

<opencv2/imgproc/imgproc.hpp>

but it doesn't work.
Title: Re: Problem with opencv library (fatal error : No such file or directory)
Post by: BlueHazzard on June 28, 2013, 11:35:56 am
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
Title: Re: Problem with opencv library (fatal error : No such file or directory)
Post by: Zekk on June 28, 2013, 12:02:01 pm
Here the message :

Code
-------------- 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)
Title: Re: Problem with opencv library (fatal error : No such file or directory)
Post by: BlueHazzard on June 28, 2013, 01:19:52 pm
Code
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....
Title: Re: Problem with opencv library (fatal error : No such file or directory)
Post by: Zekk 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.
Title: Re: Problem with opencv library (fatal error : No such file or directory)
Post by: scarphin on June 28, 2013, 03:44:47 pm
What directories do you have in your 'project->build options-> search directories->compiler' for top level?
Title: Re: Problem with opencv library (fatal error : No such file or directory)
Post by: Zekk 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.
Title: Re: Problem with opencv library (fatal error : No such file or directory)
Post by: scarphin on June 28, 2013, 11:22:12 pm
Did you actually performed the steps in http://opencv.willowgarage.com/wiki/CodeBlocks (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?
Title: Re: Problem with opencv library (fatal error : No such file or directory)
Post by: stahta01 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
C:\opencv\bluid\x86\mingw\bin

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

Tim S.
Title: Re: Problem with opencv library (fatal error : No such file or directory)
Post by: Zekk 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
C:\opencv\include

And in 'settings ->compiler ->search directories ->Linker' :

Code
C:\opencv\build\x86\mingw\lib



stahta01 :

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

Code
c:/program files (x86)/codeblocks/mingw/bin/
Title: Re: Problem with opencv library (fatal error : No such file or directory)
Post by: scarphin 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.
Title: Re: Problem with opencv library (fatal error : No such file or directory)
Post by: ollydbg on June 29, 2013, 06:25:07 pm
@Zekk (http://forums.codeblocks.org/index.php?action=profile;u=35881)
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 (http://answers.opencv.org/question/4716/which-mingw-compiler-is-used-to-create-the-pre/) 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.
Title: Re: Problem with opencv library (fatal error : No such file or directory)
Post by: Zekk 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.
Title: Re: Problem with opencv library (fatal error : No such file or directory)
Post by: scarphin 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
#include <opencv2/imgproc/imgproc.hpp>

If you still get the same error then you are missing some steps. Loop through them again.
Title: Re: Problem with opencv library (fatal error : No such file or directory)
Post by: ollydbg 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.