简体   繁体   中英

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?

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?

如果您想使用 pkg-config 命令一次将更多库链接在一起,我使用项目中编写的命令 'pkg-config --libs --cflags opencv4' 解决了我在 code::blocks 上的问题- >构建选项->“程序名称”->链接器设置->其他链接器选项

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM