How do I repair my installation of openCV

I’m using Code Blocks to try a hello world application to get started with openCV, however the include statements don’t work. I’m sure the Include statements are correct but I think I’ve installed openCV incorrectly.

These are the include statements that Code Blocks wants to use:
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>

But the libraries are not there if I change #include <opencv2/core/core.hpp> to be #include <opencv4/opencv2/core/core.hpp> then that one line will work and an include elsewhere goes wrong.

So I’ve clearly installed openCV in the wrong place and I have no idea how to fix it.

I’m using Ubuntu 22.10

What do I do?

this is the forum for OpenCV. if you need assistance configuring some IDE, which is third party software, you should try

you just misconfigured the include paths. that is not an opencv issue but an issue of how you use your IDE.

No the IDE is not the problem.

The problem is that I installed OpenCV incorrectly, and need to fix my installation of OpenCV.

I can’t find a simple document on how to uninstall. That would be a helpful start.

first, I’d recommend not bothering with C++ and OpenCV at the same time, since you appear to be a beginner. just go with python. trivial to install OpenCV for python.

if you must have OpenCV with C++, then… how did you install it? the installation is likely okay, you just misconfigured your IDE. I haven’t seen any evidence either way.

I am a beginner with OpenCV but not with C++. I want the power of C++.

The reason why the IDE is unlikely to be the problem is that with Ubuntu I need to just make one click and it got installed, fresh. I haven’t done anything to it, it is a freshly installed IDE.

The reason why I think I got the installation of OpenCV wrong is because I followed many different steps.

My logic is you can’t make a mistake with one click but you can make a mistake with many different steps.

To answer your question: A few weeks a I followed an installation tutorial website that I can’t find now. I’ve tried to install it again (without uninstalling) with OpenCV: Using OpenCV with gcc and CMake but that didn’t help.

How do I uninstall OpenCV?

that sounds like you didn’t install some debian package.

in that case, you’ll have to find out where the install copied all those files to. it’ll be the usual locations of header files, library files (.a or something?), and shared objects. try the same make install again and hopefully it prints a lot of paths, that you can delete.

if you never did a make install (or apt install something of a premade package), you didn’t actually install the library, just build it. in that case, all the headers, libs, and shared objects just hang out in the build directory of your copy of OpenCV, and maybe in an install directory, which is a kind of “redistributable” for development

1 Like

I couldn’t find an “apt install” command what’s the exact package name for the apt install command?

And what’s the repository url?

Maybe you can have a try with linux.

i dont think, you have to “repair” anything.

assuming, it is opencv4.x, and you did a proper make install , you have to set up your INCLUDE path as


and the LIB path as


also, my 2 ct : on ubuntu, rather stick with building opencv from src, anything prebuilt from ppm’s is terribly outdated