Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include OpenCV for Project in C++

Tags:

c++

opencv

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.

like image 714
jshackle Avatar asked Feb 16 '26 14:02

jshackle


2 Answers

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.

like image 91
jshackle Avatar answered Feb 18 '26 02:02

jshackle


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:
  • Additional Include Directories
  • Linker
  • Additional Dependencies
  • PATH
like image 42
DC. Cheng Avatar answered Feb 18 '26 03:02

DC. Cheng



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!