简体   繁体   English

VS2019:致命错误 C1083 无法打开头文件:'opencv.hpp'

[英]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 开发环境中设置此编译器选项

  1. Open the project's Property Pages dialog box.打开项目的属性页对话框。 For details, see Set C++ compiler and build properties in Visual Studio.有关详细信息,请参阅在 Visual Studio 中设置 C++ 编译器和生成属性。
  2. Select the Configuration Properties > C/C++ > General property page.选择配置属性 > C/C++ > 常规属性页。
  3. Modify the Additional Include Directories property.修改附加包含目录属性。

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.

相关问题 错误C1083无法在VS 2015中打开包含文件:&#39;opencv2 \\ opencv.hpp&#39; - Error C1083 Cannot open include file: 'opencv2\opencv.hpp' in VS 2015 VS2019 致命错误 C1083:无法打开编译器中间文件:xxxx.ipdb:空间不足 - VS2019 fatal error C1083: Cannot open compiler intermediate file: xxxx.ipdb: Not enough space 致命错误 C1083:无法打开包含文件:&#39;opencv2/core.hpp&#39;:没有那个文件或目录 - Fatal error C1083: Cannot open include file: 'opencv2/core.hpp': No such file or directory 致命错误C1083:无法打开包含文件:&#39;boost / variant.hpp&#39;:没有这样的文件或目录 - fatal error C1083: Cannot open include file: 'boost/variant.hpp': No such file or directory 致命错误 C1083:无法打开包含文件:“boost/config.hpp”:没有这样的文件或目录 - fatal error C1083: Cannot open include file: 'boost/config.hpp': No such file or directory Visual Studio 2012:“opencv2/opencv.hpp”:没有这样的文件或目录 (C1083) - Visual Studio 2012: 'opencv2/opencv.hpp' : No such file or directory (C1083) SWIG致命错误C1083:无法打开包含文件 - SWIG Fatal error C1083: Cannot open include file QtCreator中的“致命错误C1083:无法打开包含文件” - “Fatal Error C1083: Cannot open include file” in QtCreator vs2012 main.cpp(2):致命错误C1083:“ ********。hpp”:没有此类文件或目录 - vs2012 main.cpp(2): fatal error C1083: “********.hpp”: No such file or directory 错误:C1083:无法打开包含文件:&#39;xercesc / util / XMLString.hpp&#39;:没有这样的文件或目录 - error: C1083: Cannot open include file: 'xercesc/util/XMLString.hpp': No such file or directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM