Ask Your Question
0

problem compiling an example

asked 2017-06-11 16:20:49 -0600

xpro gravatar image

I'm trying to compile this example

https://github.com/opencv/opencv_cont...

I changed the top three lines

#include  "opencv2/text.hpp"
#include  "opencv2/highgui.hpp"
#include  "opencv2/imgproc.hpp"

to

#include  "/home/david/c/opencv-3.2.0/include/opencv2/opencv.hpp"

I get the following compilation error

david@ubuntu:~/c$ gcc opencv.cpp 
In file included from opencv.cpp:1:0:
/home/david/c/opencv-3.2.0/include/opencv2/opencv.hpp:48:38: fatal error: opencv2/opencv_modules.hpp: No such file or directory
compilation terminated.

I've been away from c++ for years, what am I doing wrong?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-06-11 18:26:06 -0600

berak gravatar image

updated 2017-06-11 18:38:09 -0600

" what am I doing wrong?" -- you're messing up the include path.

by default, opencv installs to /usr/local. you've chosen to put it into another place, but please, do not change the #include paths !

instead, give the location to your compiler, like :

g++ myprog.cpp -I /where/did/i/install/opencv/include -L /where/did/i/install/opencv/lib -o myprog

again, the install path on your box is relevant here, do not try to point it at the original src dir

also consider, using cmake to generate a makefile for your project.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-06-11 16:20:49 -0600

Seen: 8,906 times

Last updated: Jun 11 '17