参考: https://blog.csdn.net/weixin_43562948/article/details/103956901
及: https://medium.com/@gupsekobas/working-with-opencv-4-2-0-on-macos-mojave-version-10-14-4-18e226-vscode-and-c-dea26619f97
第一步安装homebrew, 我原先电脑上就有. 参考别人的文章即可.
下载opencv. 在终端中输入
brew install opencv
在国外还比较快就下完了, 我下的是4.3.0_4版.
检查安装结果
brew info opencv
就像这样就好了.
https://code.visualstudio.com/docs/cpp/config-clang-mac
用官网的教程生成三个配置文件: c_cpp_properties.json; lauch.json; tasks.json
下面贴出我的配置文件:
c_cpp_properties.json:
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
"/Library/Developer/CommandLineTools/usr/include/c++/v1",
"/usr/local/include",
"/Library/Developer/CommandLineTools/usr/lib/clang/11.0.0/include",
"/usr/local/Cellar/opencv/4.3.0_4/include",
"/usr/local/Cellar/opencv/4.3.0_4/lib",
"/usr/local/Cellar/opencv/4.3.0_4/include/opencv4",
"/Library/Developer/CommandLineTools/usr/include"
],
"defines":