Error: unexpected end of file...
I added a small C program to my VC++ MFC project. Whenever I compile my project, I get the following error. Why?
--------
g:\myvc++\mytemp\test1\rpsha.c(205) : fatal error C1010: unexpected end of file while looking for precompiled header directive
-------
[273 byte] By [
rpk2006] at [2007-11-18 17:45:35]

# 5 Re: Error: unexpected end of file...
Originally posted by Gordon
Also you can just turn off the precompiled headers for that file.
Which you can do by right clicking on the .c file and selecting build settings.
I would be carefule of mixing stdafx headers in C/C++ as your most likely going to include C++ specific header files <MFC?> in your stdafx.h
eg:
#ifndef __AFX_H__
#define __AFX_H__
#ifndef __cplusplus
#error MFC requires C++ compilation (use a .cpp suffix)
#endif
So it would probably be better to create seperate PCH files for your C++ and C modules.
I personally turn off any pch files for C code I am using. PCH has always been a big headache...that's just my personal opinion.
Mick at 2007-11-11 1:29:43 >

# 6 Re: Error: unexpected end of file...
After adding "stdafx.h", I got rid of the previous error, but now getting this error:
------
g:\myvc++\mytemp\test2\test.c(3) : fatal error C1853: 'Debug/test2.pch' is not a precompiled header file created with this compiler
------
It is very sure that I created the whole project with VC++.
# 7 Re: Error: unexpected end of file...
Try deleting the PCH file or doing a rebuild all. If that does not work then there is a problem with the way you set your project settings.