-
fatal error C1010
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.
-
Re: fatal error C1010
Make sure you add:
#include "stdafx.h"
at the top of all your cpp files.
Rail
Recording Engineer/Software Developer
Rail Jon Rogut Software
[email protected]
http://home.earthlink.net/~railro/
-
Re: fatal error C1010
That did it! Thanks alot Rail.
-
Re: fatal error C1010
but how does adding #include "stdafx.h" matter?
-
Re: fatal error C1010
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
[email protected]
http://home.earthlink.net/~railro/