Program cannot run OpenCV even though others can

c++, linux, opencv, ubuntu

Solution

On my Ubuntu 11.04, the headers are in: `*/usr/include/opencv-2.3.1/*`, I assume it should be `*/usr/include/opencv-2.4.0/*` for you.

You have two solutions:

- When you compile, use the `-I` option: `g++ -o [name] [src] -I/usr/include/opencv-2.4.0`

- Create symbolic links to opencv-2.4.0/opencv and opencv-2.4.0/opencv2 in /usr/include.

The second solution is useful if you're using CMake, because FindOpenCV2 does not look for OpenCV in `/usr/include/opencv-2.4.0`. I hope this (ugly) hack will solve your problem.

Problem

I am trying to run a program that uses OpenCV and I have gotten it to run on other machines, and other programs on my machine run using it, but this one returns: ``` programname.cpp: fatal error: opencv/cv.h: No such file or directory ``` Anyone know how to fix the path or what might be going wrong? I am running Ubuntu 12.04 and OpenCV-2.4.0

Original source