unable to find opencv through pkg-config --cflags opencv

asked 2020-02-12 06:17:27 -0600

aquarian-source gravatar image

updated 2020-02-20 05:50:37 -0600

i followed this comprehensive guide to install opencv4.1.0 in my ubuntu18.04.

https://cv-tricks.com/installation/op...

i made changes in my opencv4.pc file, added opencv2 as mentioned in install guide (includedir_old=${prefix}/include/opencv4/opencv2) and added this file to /usr/local/lib/pkg-config. i also added this path PKG_CONFIG_PATH=/usr/local/lib/pkg-config to bashrc file. i counter checked by echo command it shows the path rightly

but when i do pkg-config for opencv it still says Package opencv was not found in the pkg-config search path. Perhaps you should add the directory containing `opencv.pc' to the PKG_CONFIG_PATH environment variable Package 'opencv', required by 'world', not found

what should i do? because of this i am unable to cmake c++ file

edit retag flag offensive close merge delete

Comments

1

Perhaps you should add the directory containing `opencv.pc' to the PKG_CONFIG_PATH environment

that's step 11 in your tut.

also note, that the opencv devs prefer cmake to pkg-config

last, you should still be able to run your own cmdline (and ditch all "helpful" tools), like:

g++ my.cpp -I/usr/local/include/opencv4 -lopencv_core -o mytest
berak gravatar imageberak ( 2020-02-12 06:44:46 -0600 )edit

it's also pkg-config opencv4, not opencv

kbarni gravatar imagekbarni ( 2020-02-12 08:41:28 -0600 )edit

Thankyou @berak. opencv4 it is. one mistake i was doing: in cmake find_package(opencv) is wrong we should write find_package(OpenCV).

aquarian-source gravatar imageaquarian-source ( 2020-02-13 03:05:37 -0600 )edit