A program cannot run OpenCV, even if others can

I'm trying to run a program that uses OpenCV, and I got it to run on other machines, and other programs on my computer work with it, but this one returns:

programname.cpp: fatal error: opencv/cv.h: No such file or directory 

Does anyone know how to fix the path or what could go wrong? I am running Ubuntu 12.04 and OpenCV-2.4.0

+6
source share
2 answers

In my Ubuntu 11.04, the headers are in: */usr/include/opencv-2.3.1/* , I assume this should be */usr/include/opencv-2.4.0/* .

You have two solutions:

  • When compiling, use the -I option: g++ -o [name] [src] -I/usr/include/opencv-2.4.0
  • Creating symbolic links to opencv-2.4.0 / opencv and opencv-2.4.0 / opencv2 in / usr / include.

The second solution is useful if you use CMake, because FindOpenCV2 does not look for OpenCV in /usr/include/opencv-2.4.0 . I hope this (ugly) hacking solves your problem.

+5
source

Edit:

#include <opencv/cv.h>

in

#include <opencv2/opencv.hpp>

+6
source

Source: https://habr.com/ru/post/917228/


All Articles