簡體   English   中英

即使在Linux中使用'pkg-config --cflags --libs opencv`也無法用openCV編譯c++

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

早上好,我需要幫助 - 我有一個文件:s.cpp,它使用:

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

我寫了一個這樣的makefile:

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

並得到錯誤:

 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.

拜托,我不知道該怎么做請有人可以幫忙嗎?

早上好,請提供幫助-我有一個文件:s.cpp,該文件使用:

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

我寫了一個這樣的makefile:

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

並得到錯誤:

 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.

請,我不知道該怎么辦,請有人可以幫助?

如果您想使用 pkg-config 命令一次將更多庫鏈接在一起,我使用項目中編寫的命令 'pkg-config --libs --cflags opencv4' 解決了我在 code::blocks 上的問題- >構建選項->“程序名稱”->鏈接器設置->其他鏈接器選項

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM