首先上一下参考文献:
1 visual studio code(vscode) c++ 编译opencv并运行调试
visual studio code(vscode) c++ 编译opencv并运行调试_zoeou的博客-CSDN博客
2【工程配置】ubuntu下基于vscode进行opencv调试_小Teemo历险记-CSDN博客
3 史上最全vscode配置使用教程 - 知乎
4 ubuntu16.04+VS Code+OpenCV配置编译运行程序 - 明楼 - 博客园
5 Ubuntu 18.04系统下的环境配置vscode&&opencv&&c++ - 兵临城下的匹夫 - 博客园
其实我很想参考官方如何配置的,但一时没看到.
我在参看上述博客,配置opencv遇到了点问题,大致是这样的:vscode下需要配置的文件有三个,其中一个c_cpp_properties.json配置中是这样的:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/local/include", //请确保你的opencv opencv2头文件夹安装在这个目录
"/usr/local/include/opencv",
"/usr/local/include/opencv2",
"/usr/include"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++14",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
这个配置是网络上常用配置,但是opencv4的include目录结构是这样的:
?
?
所以你安装的是opencv4,那末你的c_cpp_properties.json配置应该是这样的:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/local/include", //请确保你的opencv opencv2头文件夹安装在这个目录
"/usr/local/include/opencv",
"/usr/local/include/opencv4/opencv2",
"/usr/include"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++14",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
|