Ask Your Question
0

Getting g++ to find all libraries in opencv install on windows 7 ultimate 64bit

asked 2014-10-24 09:56:40 -0600

Pranav Lal gravatar image

Hi all,

I am trying to compile a C++ program that uses opencv on a computer running windows 7 ultimate 64bit. I have mingw installed. My g++ commandline is as follows. g++ -I C:\devkit\mingw\include -I C:\opencv\build\include\opencv2\highgui -I C:\opencv\build\include\opencv2\imgproc -I C:\opencv\build\include\opencv2\core -O3 BatchvOICe.cpp -o vl01.exe -l C:\opencv\build\x64\vc12\lib\opencv_core -l C:\opencv\build\x64\vc12\lib\opencv_imgproc -l C:\opencv\build\x64\vc12\lib\opencv_highgui In file included from BatchvOICe.cpp:8:0: C:\opencv\build\include\opencv2\highgui/highgui.hpp:46:33: fatal error: opencv2/ core/core.hpp: No such file or directory compilation terminated.

How do I solve this? I do not want to change include paths in the opencv source.

In addition, I have downloaded visual studio express 2013. I am happy to set build paths etc but what do I set? I see instructions only for visual studio 2012. I suspect they will be the same for 2013 and I did try them but I encounter the same errors.

Note: I have installed opencv-2_4_10.exe.

I see references to opencv 3.0. My program is basic therefore I am willing to switch to opencv 3 if compiling is easier. Pranav

edit retag flag offensive close merge delete

Comments

1

You must add -I C:\opencv\build\include From there it will search for includes.

boaz001 gravatar imageboaz001 ( 2014-10-24 10:05:38 -0600 )edit

also, you cannot use the visual studio libs with mingw. (they're for usage with cl.exe only, not g++)

if you really must use g++, you will have to recompile the opencv libs using cmake (pretty similar to the way it's done on linux, just without needing any further dependancies)

berak gravatar imageberak ( 2014-10-24 10:45:36 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-10-24 15:40:04 -0600

seeingwithsound gravatar image

I've put up source code of a rudimentary OpenCV version of The vOICe as a Microsoft Visual Studio 2010 project at vOICeOpenCV.zip (currently based on OpenCV 2.4.9).

You will likely need to adapt the following Project properties because they depend on your version of OpenCV and where you installed it:

C/C++ | Additional Include Directories

Linker | Additional Library Directories

Linker | Input | Additional Dependencies

Hope this helps,

Peter Meijer

Seeing with Sound - The vOICe http://www.seeingwithsound.com

edit flag offensive delete link more

Comments

1

Hi Peter and Berak,

Many thanks for the answers and the tip about the precompiled binaries not working with g++. Peter, your visual studio project helped tremendously because I was able to see what libraries you had specified as well as how you had specified the adtional includes.

The project compiles and links successfully. Noyte: Another error I was making was that I was trying to link using 64bit libraries. I had a stack of unresolved linker errors inspite of including all the libraries in the additional dependencies edit box. I changed to using 32bit libraries and was able to link successfully.

Pranav Lal gravatar imagePranav Lal ( 2014-10-24 23:36:40 -0600 )edit

hi peter, just as a sidenote, removing the 51mb ipch file (which will be regenerated locally anyway) would reduce the download dramatically ;)

berak gravatar imageberak ( 2014-10-25 03:53:50 -0600 )edit
1

Thanks berak, I now reduced the zip file from about 17MB to about 350KB by removing generated files.

seeingwithsound gravatar imageseeingwithsound ( 2014-10-26 12:08:38 -0600 )edit

Question Tools

Stats

Asked: 2014-10-24 09:56:40 -0600

Seen: 1,716 times

Last updated: Oct 24 '14