Click to See Complete Forum and Search --> : fatal error C1010


June 10th, 1999, 06:40 PM
When trying to add a .h header file along with its .cpp file to a MFC Wizard generated program I get this error when trying to compile "fatal error C1010: unexpected end of file while looking for precompiled header directive". The header file doesn't contain a class, just a function. I also get the same error when both files are blank and contain no code at all. So whats the trick here? what am I doing wrong? Please Help.

Rail Jon Rogut
June 10th, 1999, 06:45 PM
Make sure you add:

#include "stdafx.h"


at the top of all your cpp files.

Rail

Recording Engineer/Software Developer
Rail Jon Rogut Software
railro@earthlink.net
http://home.earthlink.net/~railro/

June 10th, 1999, 06:52 PM
That did it! Thanks alot Rail.

Tapan
June 10th, 1999, 07:48 PM
but how does adding #include "stdafx.h" matter?

Rail Jon Rogut
June 10th, 1999, 10:52 PM
In your Project settings, in the C/C++ tab select Precompiled Headers as the Category and you should have "Use precompiled header file" selected. This will cause VC to create a precompiled header file. You also have to specify a file in the through header field. This defaults to stdafx.h. The compiler will ignore all code in the file up 'til (and including) that header and uses the precompiled header (pch) instead. So if you don't include the file name in this field, then the compiler will complain that it's reached the end of the file without reaching the precompiler header.

Rail

Recording Engineer/Software Developer
Rail Jon Rogut Software
railro@earthlink.net
http://home.earthlink.net/~railro/