Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I get StdAfx.cpp to compile first???

342 views
Skip to first unread message

Jean Cyr

unread,
Dec 12, 1996, 3:00:00 AM12/12/96
to

I have a large MFC application I am compiling using VC 4.0. I have
noticed that when I compile StdAfx.cpp first, the remainder of my
C++ files compile much faster. I am assuming that this has something
to do with precompiled headers.

The problem I am having is that when I do a 'Rebuild All', StdAfx.cpp
is usually one of the last files to be compiled. This makes for very
slow compilation of the other files.

Is there any way that I can force VC 4.0 to compile StdAfx.cpp first
when I do a 'Rebuild All'

Jean Cyr

jc...@magmacom.com


Andreas Arff

unread,
Dec 12, 1996, 3:00:00 AM12/12/96
to

Look in Build->Settings under the tab C/C++ under category precompiled
headers.

> Jean Cyr
>
> jc...@magmacom.com

Andreas
--
Andreas Arff
mailto:a...@ergosoft.no or mailto:and...@online.no
I am just a boring sig

Cecil Galbraith

unread,
Dec 15, 1996, 3:00:00 AM12/15/96
to Jean Cyr

Jean Cyr wrote:
>
> I have a large MFC application I am compiling using VC 4.0. I have
> noticed that when I compile StdAfx.cpp first, the remainder of my
> C++ files compile much faster. I am assuming that this has something
> to do with precompiled headers.
>
> The problem I am having is that when I do a 'Rebuild All', StdAfx.cpp
> is usually one of the last files to be compiled. This makes for very
> slow compilation of the other files.
>
> Is there any way that I can force VC 4.0 to compile StdAfx.cpp first
> when I do a 'Rebuild All'
>
> Jean Cyr
>
> jc...@magmacom.com

Make certain that you are using precompiled headers. It sounds as though
you are not!
--
Cecil Galbraith
CustomSoft mail to cgal...@concentric.net

Free programmer's utilities and MFC tips at
http://www.concentric.net/~cgalbrai

Preston L Bannister

unread,
Dec 17, 1996, 3:00:00 AM12/17/96
to

jc...@pobox.com (Jean Cyr) wrote:

>I have a large MFC application I am compiling using VC 4.0. I have
>noticed that when I compile StdAfx.cpp first, the remainder of my
>C++ files compile much faster. I am assuming that this has something
>to do with precompiled headers.

>The problem I am having is that when I do a 'Rebuild All', StdAfx.cpp
>is usually one of the last files to be compiled. This makes for very
>slow compilation of the other files.

>Is there any way that I can force VC 4.0 to compile StdAfx.cpp first
>when I do a 'Rebuild All'

Set stdafx.cpp to generate the PCH file, and all the other files to
use (not create) the PCH file. You will find that stdafx.cpp will
always get compiled first.

Look in the Build/Settings dialog, on the C/C++ page, under category
"Precompiled Headers".

Doug Stevens

unread,
Dec 17, 1996, 3:00:00 AM12/17/96
to Jean Cyr

Do the following:

1. Invoke 'Build/Settings' from the menu.
2. Under 'Settings for:', select both the debug and release versions
of the project
3. Select the C/C++ tab.
4. Under 'Category', select 'Precompiled headers'.
5. Select the 'Use precompiled header file (.PCH)' radio button;
under the button, enter 'stdafx.h' in the 'Through header:'
edit box.
6. Now under 'Settings for:', double-click on the Debug release,
then select 'stdafx.cpp' from the list of files shown under
this release
7. Select the 'Create precompiled header file (.PCH)' radio button,
under the button, enter 'stdafx.h' in the 'Through header:'
edit box.

You also need to be sure that '#include <stdafx.h>' or
'#include "stdafx.h"' (depending on how you like to use header
file paths) is the _first_ include in each .cpp file, including
stdafx.cpp.

This will give you nice, fast compiles, much faster than checking
'Automatic use of precompiled headers'.Jean Cyr wrote:

0 new messages