Please help, opencv2 build problem in ofxCvConstants since ubuntu studio update

Hi all, I got into learning coding and building some OF projects over lockdown and now I have the time to get back into it but my last project has suddenly stopped building :frowning:
I am getting a “opencv2/core/version.hpp” file not found message bubbling up from of_v0.11.0_linux64gcc6_release/addons/ofxOpenCv/src/ofxCvConstants.h which seems to be fixed if I add the “opencv4/” directory to the front of the filepath but then the opencv files themselves seem to start failing as they all have include paths of “opencv2/” as well.

It’s probably a really stupid question that doesn’t make any sense but I am at a loss as to where to start as I didn’t do any work on the project between it working and now failing to build.

you can find the project at if you think you may be able to help. Thanks ever so much and apologies again for my idiot level of understanding.



I found that typing sudo ln -s /usr/include/opencv4/opencv2/ /usr/include/opencv2
into my terminal fixed the problem, I think it just gives a clue to the include directives??

Apparently this command creates a “symbolic link” via the opencv2 path to the opencv4 target

Hi @Giles_Webberley welcome to the OF forum.
there are no stupid questions here. so feel free to ask whatever you want to.

OF comes with openCv libraries included, so there shouldnt be a problem using it or the need to install it.
It seems like you have openCv installed as part of your system, and that might be giving problems.
Which OS and IDE are you using?
Are you adding openCv (by adding ofxOpenCv) and the project generator or are you adding it manually?
I would recommend to always stick to the project generator.

When running the script from scripts/linux/ubuntu ( []( and [] from ubuntu you should see a message about updating the version of OpenCV from openCV2 to openCV4, if your install of OpenCV is correct.

Hello, thanks ever so much for the welcome, and more to the point thank you all so much for producing this incredible framework!! It has allowed me to produce some pieces that I have been thinking about for years with just a very distant background in javascript.

I’m using an ubuntu distro called Ubuntu Studio as I had a background in film and photography, and not lot of confidence with the command line. I ended up using QtCreator as my IDE as it was the only one that seemed to be available on Linux and could compile OF projects natively (as I was afraid of the extra confusion this part of the process may have introduced). I’ve tried to get in the habit of doing these things manually since so that I can come across these problems and then find my way to a solution.

Many thanks,

1 Like

Hey thanks so much, tbh my comfort with the terminal is still very little but that was an excellent solution that would have saved me the panic and the time finding the solution I ended up using.

I really appreciate the response and the guidance, I’m sure you’ll be hearing a lot more from me over these coming months as I try to get my skills and portfolio to a reasonable junior level. Any feedback on coding style and practices from any of you guys would also be gratefully received; obviously you’d have to be at quite a loss as to what to do to find the time to read through my mess but if you do.



Hi @Giles_Webberley glad to hear that you were able to figure it out.

If you have any doubt or need help just post here in the forum.

I would recommend you to read the ofBook which is a great resource for learning openFrameworks.