Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reduce compilation times

Status
Not open for further replies.

globos

Programmer
Nov 8, 2000
260
FR
Hi,

I don't follow the recommended C++ practice that consists to separate header files and implementation files.
Most of my classes are fully defined in their header files.

The well-known drawback is that it makes compilation slow.
By now I feel the need to really reduce compilation times, I found two simple ways :
- use precompiled headers.
- keep implementation of the classes in cpp files instead in headers.

I tried to use precompiled headers but compilation speed is the same. I have only tried the automatic mode(i.e. /YX). I'm not very seduced by the manual mode because I don't want to pollute my work with the horrible "#pragma hdrstop", and don't feel sure where to put it.
Does anyone know how to use correctly the automatic mode?
I can't find more help from MSDN (to be short it just tells "use /YX").


The other solution is easy, but painful if non automated. I can't find tools that generates implementation files from header files. Actually from one of my header file I need to create two files:
- A header file, which is the prototype of the class(no implementation)
- An implemenation file

Does anyone know such tools?


Thanks to all.

--
Globos
 
Are all your (large) member functions written as
Code:
class foo {
  public:
    void func(void);
};

void foo::func ( void ) {
  // do stuff
}

Or
Code:
class foo {
  public:
  void func ( void ) {
    // do stuff
  }
};

If it's the former, then you should be able to begin your foo.cpp file with
[tt]#include "foo.h"[/tt]
Then cut and paste all the function bodies from foo.h into foo.cpp


--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top