/bin/sh: pkg-config: 找不到命令

Posted

技术标签:

【中文标题】/bin/sh: pkg-config: 找不到命令【英文标题】:/bin/sh: pkg-config: command not found 【发布时间】:2014-04-21 16:00:26 【问题描述】:

我正在尝试从此链接https://github.com/simena86/handDetectionCV 运行手势识别 openCV 示例项目。我在 cygwin 终端中运行 make 命令,但出现错误。我在 cygwin 终端 E:\handDetectionCVmaster\make

中运行以下命令

输出:

 Arun@Arun-PC /cygdrive/e/handDetectionCVmaster
    $ make
    g++ -o opencv main.cpp myImage.cpp handGesture.cpp roi.cpp  `pkg-config --cflags --libs opencv`
    /bin/sh: pkg-config: command not found
    main.cpp:1:39: error: opencv2/imgproc/imgproc.hpp: No such file or directory
    main.cpp:2:29: error: opencv2/opencv.hpp: No such file or directory
    main.cpp:3:39: error: opencv2/highgui/highgui.hpp: No such file or directory
    In file included from main.cpp:8:
    myImage.hpp:8: error: 'cv' is not a namespace-name
    myImage.hpp:8: error: expected namespace-name before ';' token
    myImage.hpp:15: error: 'Mat' does not name a type
    myImage.hpp:16: error: 'Mat' does not name a type
    myImage.hpp:17: error: 'Mat' does not name a type
    myImage.hpp:18: error: 'Mat' was not declared in this scope
    myImage.hpp:18: error: template argument 1 is invalid
    myImage.hpp:18: error: template argument 2 is invalid
    myImage.hpp:19: error: 'VideoCapture' does not name a type
    In file included from main.cpp:9:
    roi.hpp:9: error: 'cv' is not a namespace-name
    roi.hpp:9: error: expected namespace-name before ';' token
    roi.hpp:14: error: expected ')' before 'upper_corner'
    roi.hpp:15: error: 'Point' does not name a type
    roi.hpp:16: error: 'Mat' does not name a type
    roi.hpp:17: error: 'Scalar' does not name a type
    roi.hpp:19: error: 'Mat' has not been declared
    In file included from main.cpp:10:
    handGesture.hpp:11: error: 'cv' is not a namespace-name
    handGesture.hpp:11: error: expected namespace-name before ';' token
    handGesture.hpp:18: error: 'Point' was not declared in this scope
    handGesture.hpp:18: error: template argument 1 is invalid
    handGesture.hpp:18: error: template argument 2 is invalid
    handGesture.hpp:18: error: template argument 1 is invalid
    handGesture.hpp:18: error: template argument 2 is invalid
    handGesture.hpp:20: error: 'Point' was not declared in this scope
    handGesture.hpp:20: error: template argument 1 is invalid
    handGesture.hpp:20: error: template argument 2 is invalid
    handGesture.hpp:20: error: template argument 1 is invalid
    handGesture.hpp:20: error: template argument 2 is invalid
    handGesture.hpp:21: error: 'Vec4i' was not declared in this scope
    handGesture.hpp:21: error: template argument 1 is invalid
    handGesture.hpp:21: error: template argument 2 is invalid
    handGesture.hpp:21: error: template argument 1 is invalid
    handGesture.hpp:21: error: template argument 2 is invalid
    handGesture.hpp:22: error: 'Point' was not declared in this scope
    handGesture.hpp:22: error: template argument 1 is invalid
    handGesture.hpp:22: error: template argument 2 is invalid
    handGesture.hpp:23: error: 'Rect' does not name a type
    handGesture.hpp:24: error: 'Mat' has not been declared
    handGesture.hpp:29: error: 'Rect' does not name a type
    handGesture.hpp:44: error: 'Point' has not been declared
    handGesture.hpp:44: error: 'Point' has not been declared
    handGesture.hpp:44: error: 'Point' has not been declared
    handGesture.hpp:53: error: 'Scalar' does not name a type
    handGesture.hpp:55: error: 'Point' has not been declared
    handGesture.hpp:55: error: 'Point' has not been declared
    handGesture.hpp:56: error: 'Vec4i' was not declared in this scope
    handGesture.hpp:56: error: template argument 1 is invalid
    handGesture.hpp:56: error: template argument 2 is invalid
    main.cpp:15: error: 'cv' is not a namespace-name
    main.cpp:15: error: expected namespace-name before ';' token
    main.cpp:19: error: 'FONT_HERSHEY_PLAIN' was not declared in this scope

【问题讨论】:

我应该安装哪一个? 【参考方案1】:

这意味着您错过了 pkg-config 安装。这也是导致其余错误的原因,因为无法分别调用 pkg-config 命令的输出。

转到以下网址,获取并安装它:

http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.26-1_win32.zip

请注意,您可能需要从该站点安装更多依赖项,但基本上它应该可以工作。

【讨论】:

当我尝试从这个路径安装 E:\AR\openCV\pkg-config_0.26-1_win32\bin。我收到以下错误:程序无法启动,因为您的计算机缺少 libglib-2.0-0.dll @user3496826:请参阅我的帖子中的Please note that you might need to install further dependencies from that site, but then it oughta work, basically.。 IOW,获取ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28/… 和ftp.gnome.org/pub/gnome/binaries/win32/dependencies/… 我需要安装该链接中的所有依赖项吗? @user3496826,是的,但为方便起见,请查看我评论中的两个链接。 如何从 gettext-runtime_0.18.1.1-2_win32\bin 安装 intl.dll

以上是关于/bin/sh: pkg-config: 找不到命令的主要内容,如果未能解决你的问题,请参考以下文章

pkg-config 找不到 gtk+-3.0

pkg-config 找不到 .pc 文件,尽管它们在路径中

在 pkg-config 搜索路径中找不到软件包 libusb

在 pkg-config 搜索路径中找不到包检查

在 centos 的 pkg-config 搜索路径中找不到 package opencv

在 pkg-config 搜索路径中找不到包