在VC ++中使用opencv时无法打开包含文件:"stdafx.h" [英] Cannot open include file: 'stdafx.h' when using opencv in VC++

查看:754
本文介绍了在VC ++中使用opencv时无法打开包含文件:"stdafx.h"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到此错误无法打开包含文件:" stdafx.h":没有这样的文件或目录",我已经包含了openCV Wiki中提到的所有库文件.
我想我没有图像文件

这是我的代码

Hi, I get this error "Cannot open include file: ''stdafx.h'': No such file or directory", I have included all the library files as mentioned in the openCV wiki.

I think i dont have the image file

here is my code

#include "stdafx.h"

#include <cv.h>
#include <cxcore.h>
#include <highgui.h>

int _tmain(int argc, _TCHAR* argv[])
{
	IplImage *img = cvLoadImage("Image.bmp");
	cvNamedWindow("Image:", 1);
	cvShowImage("Image:", img);

	cvWaitKey();
	cvDestroyWindow("Image: ");
	cvReleaseImage(&img);

	return 0;
}



是吗?



ANy idea ?

推荐答案

文件stdafx.h是否存在于 cpp 文件所在的文件夹中?

该文件由 Visual C ++ 创建,与预编译头文件一起使用.

但是,您的代码仅使用与 OpenCV 库相关的内容:我认为您可以简单地使用#include "stdafx.h"语句删除或注释该行,并检查您的 cpp 文件没有请勿使用 pch (在解决方案资源管理器中右键单击它并选择属性,然后查看 C/C ++部分-> 预编译标题:第一个字段应设置为不使用预编译标题)
Does the file stdafx.h exists in the same folder where your cpp file is located?

That file is created by Visual C++ to be used with pre-compiled headers.

However your code is using only stuffs related to the OpenCV library: I think you can simply remove or comment the line with the #include "stdafx.h" statement and check that your cpp file doesn''t use pch (in the Solution explorer right click on it and select Properties, then look at the section C/C++ -> Precompiled Headers: the first field should be set to Not using Precompiled Headers)


答案已解决到此链接将对您有所帮助->>

http://www. opencv.org.cn/index.php/VC_2008_Express%E4%B8%8B%E5%AE%89%E8%A3%85OpenCV2.0

它是日文,但是可以通过单击翻译按钮进行翻译.
Answer resolved go to this link it will help you ->>

http://www.opencv.org.cn/index.php/VC_2008_Express%E4%B8%8B%E5%AE%89%E8%A3%85OpenCV2.0

It is in japanese but translate it by clicking the translate button.


这篇关于在VC ++中使用opencv时无法打开包含文件:"stdafx.h"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆