CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Guest

    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.


  2. #2
    Join Date
    May 1999
    Location
    CA, USA
    Posts
    586

    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/

  3. #3
    Guest

    Re: fatal error C1010

    That did it! Thanks alot Rail.


  4. #4
    Join Date
    May 1999
    Posts
    19

    Re: fatal error C1010

    but how does adding #include "stdafx.h" matter?


  5. #5
    Join Date
    May 1999
    Location
    CA, USA
    Posts
    586

    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/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured