precompiled header error

Hello.  My name is Jong Woo Park from S. KOREA

When compiling, I met error message like this
"unexpected end of file while looking for precompiled header

This problem was solved with attaching this header on my class
like this.

#include "stdafx.h"

My class has no relation with atdafx.h , It was compiled and run in
DOS mode(win32 console application mode)  but when I add this
class to my window program project, precomfiled file error occurred.

Could you explane about this?
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

mikeblasConnect With a Mentor Commented:
If you don't want to use "stdafx.h", then you must not provide the /Yu command-line option. The /Yu option tells the compiler to look for a particular #include directive, and that directive is expected to reference the header file named with the /Yu option.

I think you have "/Yu stdafx.h" on your command line.

If you're using the IDE, you can do this:

1) Use the "Settings..." command in the "project" menu
2) In the resulting "Project settings" dialog, expand the items in the left-hand side tree control.
3) Highlight the source file in question.
4) Activate the "C/C++" tab on the right hand side
5) Pick "Precompiled headers" in the drop-down "Category" list
6) mark the "not using precompiled headers" radio button

Make sure you do "Rebuild all" after this change.

..B ekiM

worker018Author Commented:
Thank you for your answer
Sure; I hope it helped.  Why did you give a grade of "B"?  Did you find something wrong with the answer?  Was there something you needed that I left out?

..B ekiM
All Courses

From novice to tech pro — start learning today.