mrg*_*oom 1 c++ macos opencv makefile
我使用的是 mac os 10.10,我需要通过 make 构建一些代码,但它给了我一个错误
make
gcc `pkg-config --cflags opencv` -O3 `pkg-config --libs opencv` -o congealReal congealReal.cpp
/bin/sh: pkg-config: command not found
/bin/sh: pkg-config: command not found
congealReal.cpp:87:10: fatal error: 'cv.h' file not found
#include <cv.h>
Run Code Online (Sandbox Code Playgroud)
但我已经通过brew安装了opencv
brew install opencv
Warning: homebrew/science/opencv-2.4.11_2 already installed
Run Code Online (Sandbox Code Playgroud)
那么如何在 mac os 中设置 opencv 环境呢?
我遇到了同样的问题,并通过以下步骤解决了它。第一次更新自制程序。
brew update
Run Code Online (Sandbox Code Playgroud)
第二步:安装包配置:
brew install pkg-config
Run Code Online (Sandbox Code Playgroud)
第三步:如果没有安装 OpenCV
brew install opencv@2
Run Code Online (Sandbox Code Playgroud)
第四步:现在您需要将 OpenCV 添加到您的 pkg-config 中
export PKG_CONFIG_PATH="/usr/local/opt/opencv@2/lib/pkgconfig"
Run Code Online (Sandbox Code Playgroud)