When using CMarkup in Visual Studio, you may get the following error:

d:\...\Include\Markup.cpp(1393) : fatal error C1010: 
unexpected end of file while looking for precompiled header directive

You either have to turn off the precompiled header setting for Markup.cpp or add #include "stdafx.h" at the top of Markup.cpp.

 

comment posted precompiled headers

George 02-Mar-2007

Using vs.net 2005 I was able to compile everything ok. Here is something maybe the users should be aware: suppose you create a simple Windows app (console app) and include the Markup unit. Normally, your app will be created to include precompiled headers and CMarkup will not compile because it does not have a #include "stdafx.h". The fix is simple. Just set the compiler option ONLY for the Markup unit to not using precompiled headers. With this fix, everything compiles ok.

Thanks! Again, for other readers, here are the steps for turning off precompiled headers for Markup.cpp:

In Visual Studio 6.0 (VC6) you go to Project Settings, select Markup.cpp in the tree on the left and from the "Settings for" dropdown choose "All Configurations", then go to the C/C++ tab, select Precompiled Headers from the drop-down, and select "Not Using Precompiled Headers."

In Visual Studio 2005, right-click Markup.cpp in the Solution Explorer, select Properties, and in the Markup.cpp Properties dialog open the C/C++ part of the tree and select Precompiled Headers, then next to "Create/Use Precompiled Header" choose "Not Using Precompiled Headers" from the dropdown.

Additional information

Prior to CMarkup release 9.0, Markup.cpp included "stdafx.h" but MarkupSTL.cpp did not, so you would have to do the above step for MarkupSTL.cpp pre-release 9.0. But since the Release 9.0 merge, it will be necessary for Markup.cpp whether you are using MFC or STL.

The way precompiled headers work, it is not possible to put a conditional precompiler directive around the stdafx include. Visual C++ ignores everything up to the stdafx include, which is why the error says "unexpected end of file" when it does not find the stdafx include. If you put an #ifdef before the stdafx include, it will be ignored and the Visual C++ compiler will report an error when it hits the corresponding #endif. This is why it was not possible to have Markup.cpp include stdafx for Visual Studio but not for other compilers; so it had to be left out.