2

I feel like this should be basic, but I can't find anything for it online. I downloaded OpenCV and can't figure out how to have my projects recognize it. When I try to include it with like

#include <opencv2/core/version.hpp>

I get the error:

"No such file or directory"

The only solution I've tried is to add /usr/include/opencv4/ to my PATH. Also, I am running ArchLinux if that is helpful to know.

AbdelAziz AbdelLatef
  • 3,650
  • 6
  • 24
  • 52
jshackle
  • 117
  • 8
  • https://docs.opencv.org/master/db/df5/tutorial_linux_gcc_cmake.html – Miki Jan 28 '21 at 09:52
  • 1
    This is clearly duplicate of [linking opencv libraries with g++](https://stackoverflow.com/questions/23162399/linking-opencv-libraries-with-g). Please search before asking about basics – Yunus Temurlenk Jan 28 '21 at 16:17

3 Answers3

1

So I ended up just moving the directory /usr/include/opencv4/opencv2 to /usr/include and that worked. Unless there are any ways to add directories to the list of directories that c++ checks when running the #include, this is the only way I've figured to solve it.

jshackle
  • 117
  • 8
1

if you have trouble with this

#include <opencv2/core/version.hpp>

You can find more detail information on "Googling".
what I have organized shown below:

  1. try using include "opencv2/core/version.hpp" instead of it.
  2. right-click, then check-the-location
  3. recheck several environment settings:
DC. Cheng
  • 13
  • 4
0

Try changing these three:

PATH=$PATH:/usr/bin
CPATH=$CPATH:/usr/include/opencv4
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64:/usr/lib
AbdelAziz AbdelLatef
  • 3,650
  • 6
  • 24
  • 52