Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

C++
#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 ?
Posted
Updated 20-Jul-10 5:05am
v2

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)
 
Share this answer
 
v2
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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900