C1010: unexpected end of file while looking for precompiled header directive
-
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.
-
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.
-
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.
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? -
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?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
-
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
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!
-
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!
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 )
-
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 )
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.