Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. C1010: unexpected end of file while looking for precompiled header directive

C1010: unexpected end of file while looking for precompiled header directive

Scheduled Pinned Locked Moved C / C++ / MFC
c++csharpwindows-adminhelpworkspace
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Raskolnikov
    wrote on last edited by
    #1

    I have a .cpp file that compiles fine when used in a console app but gets errors when I include it in a MFC App. d:\Visual C++.NET In 21 Days\Day 06 Dialogs\CMatrixTest.cpp(588): fatal error C1010: unexpected end of file while looking for precompiled header directive I look up error 1010 and I get the increadibly useful result "The configuration registry key is invalid." The file consists of a class definition that uses the standard template library. No main() or WinMain() function. I haven't included it yet in any other files. Anyone have a clue as to what's going wrong because I sure don't.

    R R 2 Replies Last reply
    0
    • R Raskolnikov

      I have a .cpp file that compiles fine when used in a console app but gets errors when I include it in a MFC App. d:\Visual C++.NET In 21 Days\Day 06 Dialogs\CMatrixTest.cpp(588): fatal error C1010: unexpected end of file while looking for precompiled header directive I look up error 1010 and I get the increadibly useful result "The configuration registry key is invalid." The file consists of a class definition that uses the standard template library. No main() or WinMain() function. I haven't included it yet in any other files. Anyone have a clue as to what's going wrong because I sure don't.

      R Offline
      R Offline
      RichB
      wrote on last edited by
      #2

      Raskolnikov, I've had problems with a similar message before. Go to the offending file and delete any and all characters at the end after your last statement. When I have done this, it usually clears it up. Good luck! Rich

      1 Reply Last reply
      0
      • R Raskolnikov

        I have a .cpp file that compiles fine when used in a console app but gets errors when I include it in a MFC App. d:\Visual C++.NET In 21 Days\Day 06 Dialogs\CMatrixTest.cpp(588): fatal error C1010: unexpected end of file while looking for precompiled header directive I look up error 1010 and I get the increadibly useful result "The configuration registry key is invalid." The file consists of a class definition that uses the standard template library. No main() or WinMain() function. I haven't included it yet in any other files. Anyone have a clue as to what's going wrong because I sure don't.

        R Offline
        R Offline
        Raskolnikov
        wrote on last edited by
        #3

        I looked and every other file in a MFC app had this line so I added it and the program compiled. #include "stdafx.h" I hate Microsoft. What does "The configuration registry key is invalid." have to do with no including "stdafx.h"? Can anyone know why I need to add this header file to all my .cpp files?

        J 1 Reply Last reply
        0
        • R Raskolnikov

          I looked and every other file in a MFC app had this line so I added it and the program compiled. #include "stdafx.h" I hate Microsoft. What does "The configuration registry key is invalid." have to do with no including "stdafx.h"? Can anyone know why I need to add this header file to all my .cpp files?

          J Offline
          J Offline
          Jim Crafton
          wrote on last edited by
          #4

          Raskolnikov wrote: Can anyone know why I need to add this header file to all my .cpp files THe simple answer: Precompiled headers It makes a huge difference in compile times, however it is not hte most logical thing to use in the settings You can turn it off for the whole project if you go to "Project Settings" and click the "C++ tab" and the "Precompiled Headers" category. If you click on "Not using procompiled headers" it will get rid of this problem but considerably slow things down. If you just want to shut it off for the file, then you can click on the file (still in the project settings dialog) and for the precompiled header settings just turn them off ONLY for the offending file. If you are doing MFC stuff it is worth leaving them on

          R 1 Reply Last reply
          0
          • J Jim Crafton

            Raskolnikov wrote: Can anyone know why I need to add this header file to all my .cpp files THe simple answer: Precompiled headers It makes a huge difference in compile times, however it is not hte most logical thing to use in the settings You can turn it off for the whole project if you go to "Project Settings" and click the "C++ tab" and the "Precompiled Headers" category. If you click on "Not using procompiled headers" it will get rid of this problem but considerably slow things down. If you just want to shut it off for the file, then you can click on the file (still in the project settings dialog) and for the precompiled header settings just turn them off ONLY for the offending file. If you are doing MFC stuff it is worth leaving them on

            R Offline
            R Offline
            Raskolnikov
            wrote on last edited by
            #5

            I don't mind the feature now that I know what it does, but the error message bites. "must #include stdafx.h when using precompiled headers" or any error message that mentioned either stdafx.h or precompiled header would be better than a cryptic message about an invalid registry configuration key. Maybe the message makes sense to the implementers, but error messages should be written at the users level of abstraction!

            C 1 Reply Last reply
            0
            • R Raskolnikov

              I don't mind the feature now that I know what it does, but the error message bites. "must #include stdafx.h when using precompiled headers" or any error message that mentioned either stdafx.h or precompiled header would be better than a cryptic message about an invalid registry configuration key. Maybe the message makes sense to the implementers, but error messages should be written at the users level of abstraction!

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              The message was fatal error C1010: unexpected end of file while looking for precompiled header directive and it is not at ALL cryptic. Your precompiled header does not need to be called stdafx.h, and it's reasonable to consider that the user of a C++ compiler will either know what a precompiled header is, or be able to find out. BTW you can also tell the compiler to automatically use precompiled headers with stdafx.h, and it will simply not use the precompiled headers where stdafx.h is not included. But it's usually better to include it everywhere, stdafx is a good central point to include libraries you want visible through the project, etc. For example, you'll find my stdafx is always going to include string, iostream, sstream, fstream, vector and algorithm with appropriate using statements as a minimum Christian We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )

              R 1 Reply Last reply
              0
              • C Christian Graus

                The message was fatal error C1010: unexpected end of file while looking for precompiled header directive and it is not at ALL cryptic. Your precompiled header does not need to be called stdafx.h, and it's reasonable to consider that the user of a C++ compiler will either know what a precompiled header is, or be able to find out. BTW you can also tell the compiler to automatically use precompiled headers with stdafx.h, and it will simply not use the precompiled headers where stdafx.h is not included. But it's usually better to include it everywhere, stdafx is a good central point to include libraries you want visible through the project, etc. For example, you'll find my stdafx is always going to include string, iostream, sstream, fstream, vector and algorithm with appropriate using statements as a minimum Christian We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )

                R Offline
                R Offline
                Raskolnikov
                wrote on last edited by
                #7

                The compiler error was fine, what I was upset about was the result I got when I tried to find further informaiton about the error using the error lookup tool, which I know now has nothing to do with compiler errors. Anyway I have been using C++ compilers for years, mainly with compand line compilers like gcc but I have never heard of precomiled headers or precomiled header directives. The Visual C++ .NET book I am just read fails to mention them.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups