我正在使用VScode,如果我运行:
g++ main.cpp
我收到此错误:
PS C:\ Users \ giorg \ Documents \ Development \ Tests \ node-addons-test \ src> g ++ main.cpp
main.cpp:2:30: fatal error: opencv2/opencv.hpp: No such file or directory
#include <opencv2/opencv.hpp>
^
#include <stdio.h>
#include <opencv2/opencv.hpp>
using namespace cv;
int main(int argc, char** argv )
{
if ( argc != 2 )
{
printf("usage: DisplayImage.out <Image_Path>\n");
return -1;
}
Mat image;
image = imread( argv[1], 1 );
if ( !image.data )
{
printf("No image data \n");
return -1;
}
namedWindow("Display Image", WINDOW_AUTOSIZE );
imshow("Display Image", image);
waitKey(0);
return 0;
}
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/src/lib",
"${workspaceFolder}/src",
"C:\\openCV\\opencv\\build\\include"
],
"browse": {
"path": [
"C:\\openCV\\opencv\\build\\x64\\vc15\\lib"
]
},
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.17134.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.14.26428/bin/Hostx64/x64/cl.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x64"
}
],
"version": 4
}
我应该怎么做才能在vscode上使用opencv? 在此先感谢您,我相信会有更多的开发人员面临此问题,并且更多的开发人员将在功能上面对这一问题。