Shirly
Shirly

Reputation: 76

unable to compiling c++ with openCV even using 'pkg-config --cflags --libs opencv` in Linux

good morning, please I need help- I have a file: s.cpp that uses:

#include <opencv2/highgui.hpp>
#include <opencv2/features2d.hpp>

and I wrote a makefile like this:

s: s.o
g++ s.o -o s


s.o: s.cpp
    g++ s.cpp -c `pkg-config --cflags --libs opencv`

clean: rm -f s

and got the error:

 g++ s.cpp -c `pkg-config --cflags --libs opencv`
s.cpp:9:10: fatal error: opencv2/highgui.hpp: No such file or directory
 #include <opencv2/highgui.hpp>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.

please, I dont know what to do please someone can help?

Upvotes: 0

Views: 661

Answers (1)

marco
marco

Reputation: 11

if you are are trying to link more libraries all together in one time using the pkg-config command, I solved my problems on code::blocks with the command

pkg-config --libs --cflags opencv4

written in the project->build option->"program name"->linker settings->other linker option

Upvotes: 1

Related Questions