Re: VC++ Express edition question!



Hello Nathan,

Oh dear, I was told to do this earlier for the older VC++ compiler.

Basicaly, I have included the <stdio.h> file and did the precompiled header
modification and now it compiles. I thankyou for your help.

So I have never really questioned myself about precompiled headers when I
was doing some VC++ programming, I just included it because it was shown to
include it in the sample code.

So in a nutshell, what is so special about these precompiled headers? And
should I worry to know more about them?

Thanks!

--
Best regards
Roberto


"Nathan Mates" wrote:

In article <DACFCCE4-7D5C-43A1-9F58-5434C99A4EC8@xxxxxxxxxxxxx>,
=?Utf-8?B?Um9iYnk=?= <Robby@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Now I am trying to do the same thing with VC++ 2008 Express edition. I don't
know why I have such difficulty with doing C in VC++, there is just too much
types of projects to choose from, and I get confused. Can someone please
guide me on this.

[...]

.\ccc.c(79) : fatal error C1010: unexpected end of file while looking for
precompiled header. Did you forget to add '#include "stdafx.h"' to your
source?

This is because Microsoft assumes that (1) everyone wants to use a
precompiled header -- which is really useful if and only if you know
what you're doing, and (2) people will recognize 'stdafx.h' as the
name of the file to use as a precompiled header. I've commented on
this before -- it's a decade overdue to get out of the MS-DOS 8.3
overabbreviated filename paradigm, and rename the *default* setting
here to something reasonable like '{$Project}PrecompiledHeader.h".

Two possible solutions:

1) When you create your project in DevStudio, after entering the
name, directory, etc, on the page that says "Click Finish to accept
the current settings," do **NOT** hit Finish. It's a trap. Instead,
go to the 'Application Settings' item, and unclick the [x] Precompiled
Header item. (Or, click on [x] Empty Project, which does the same, and
more.)

2) If you don't want to recreate your project, then right click on the
project in the Solution Explorer, and select Properties. Then, select
Configuration: All Configurations (at top-left), then go to
Configuration Properties -> C/C++ -> Precompiled Headers, and set
Create/Use Precompiled Header to "Not Using Precompiled Headers."

Nathan Mates
--
<*> Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein

.



Relevant Pages

  • Re: Seeting malloc pointer to NULL [2] -Totally confused!!!!!
    ... unexpected end of file while looking for precompiled header ... Those won't be available on your MCU compiler anyway, ... using namespace System; ... contains will also be available there, be ready for missing functionality. ...
    (microsoft.public.vc.language)
  • Re: VC2005 Pro: IDE (Compiler ?) cant find Stdafx.h
    ... >> words you told the compiler to include a file that does not exist. ... > "stdafx.h" statement in my source files. ... A precompiled header has a .pch extension. ... under Templates (right window) ...
    (microsoft.public.vc.language)
  • Re: VC2005 Pro: IDE (Compiler ?) cant find Stdafx.h
    ... That is the file that the compiler produces. ... >> stdafx.h+.cpp as well as some other resource files, ... empty project has to be unchecked and ...
    (microsoft.public.vc.language)
  • Re: VC2005 Pro: IDE (Compiler ?) cant find Stdafx.h
    ... >>> you do not have a stdafx.h file in your project directory. ... >>> words you told the compiler to include a file that does not exist. ... >> using precompiled header files. ... > under Templates (right window) ...
    (microsoft.public.vc.language)
  • Re: Interesting #define #ifdef behavior
    ... header, or any of the headers that are included in the precompiled header, ... would mean using the precompiled header feature could cause problems ... PCH is included, the compiler takes the PCH as-is and takes it from there. ...
    (microsoft.public.vc.language)