Why is my VisualStudio in Ubuntu 18.04 not recognizing my opencv headers?

So, I’m sorry if my question sounds a bit basic. I just started working on ubuntu and opencv and I’m not so sure where the error is

I downloaded Opencv and cmake on my ubuntu 18.04 and decided to run a simple code of reading camera files. The code is fine by itself, but there is one error that’s keeping me from compiling.

It is not recognizing the opencv headers, eventhough I have opencv on my ubuntu

#include <opencv4/opencv2/opencv.hpp>
#include <opencv4/opencv2/imgproc.hpp>
#include <opencv4/opencv2/highgui.hpp>
#include <opencv4/opencv2/imgcoecs.hpp>

It keeps saying “Cannot open source file (header)”

What could be the problem?

assuming, you did a proper make install when building the libs,
and left the CMAKE_INSTALL_PREFIX as is (/usr/local) it should be:

#include <opencv2/opencv.hpp>

and you should adjust your “Additional include path” to

/usr/local/include/opencv4
1 Like

no way it was that simple… I feel so stupid…

Thanks a lot. Saved my ass.

1 Like