[英]VS2019:fatal error C1083 Cannot open header file: 'opencv.hpp'
It is all fine when I was writing the code, that is, when I included the header file "opencv2/opencv.hpp",写代码的时候一切正常,也就是当我包含头文件“opencv2/opencv.hpp”时,
and VS2019 can indeed "see" it,而VS2019确实可以“看到”它,
in other words, I can use the class that is in the opencv.hpp, but only when I complied the project,c1083 occurred换句话说,我可以使用opencv.hpp中的类,但只有在我编译项目时,才会出现c1083
before i added the function DrawLine(),i compiled for times,with no err.and then i added the function DrawLine(..),error occurred在我添加函数 DrawLine() 之前,我编译了多次,没有错误。然后我添加函数 DrawLine(..),发生错误
this is the total source code这是全部源代码
ah啊
a.cpp a.cpp
//a.h
#include<opencv2\opencv.hpp>
using namespace cv;
class Canvas{
Mat mat_canvas;
void Init(){
mat_canvas.create(1024,1024,CV_32FC3);
}
void DrawLine(float ax,float ay,float bx,float by);
}
//a.cpp
#include"a.h"
void Canvas::DrawLine(float ax,float ay,float bx,float by){
cv::line(this->mat_canvas,Point2f(ax,ax),Point2f(bx,by),Scalar(1,1,1));
}
error msg was:错误消息是:
fatal error C1083 Cannot open header file: 'opencv.hpp': no such file or dir
i know i can create a new solution and move my old solution to it,but it takes time,and i can't actually know whether this issue will happen again in my new solution我知道我可以创建一个新的解决方案并将我的旧解决方案移到它上面,但这需要时间,而且我实际上不知道这个问题是否会在我的新解决方案中再次发生
Any answer will be helpful任何答案都会有所帮助
Actually there are most of the time possibility of missing "Additional include directory path" or wrongly setup.实际上,大多数情况下可能会丢失“附加包含目录路径”或错误设置。
Where to find in Visual Studio:在 Visual Studio 中的位置:
To set this compiler option in the Visual Studio development environment在 Visual Studio 开发环境中设置此编译器选项
Visual Studio 2019 C++ Project configuration Visual Studio 2019 C++ 项目配置
Example project setup is described in below link: Example setup下面的链接描述了示例项目设置: 示例设置
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.