简体   繁体   中英

Include OpenCV for Project in C++

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.

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.

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:

Try changing these three:

PATH=$PATH:/usr/bin
CPATH=$CPATH:/usr/include/opencv4
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64:/usr/lib

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM