How to speed up C++/CLI build process?

  • Thread starter Thread starter hesicong
  • Start date Start date
H

hesicong

I notice that compiling older C++ program with /clr option needs a lot
of time. Now I have a program below which use mix code feature in C++/CLI:
#include "stdafx.h"
#include "ManagedException.h"
class MixClass
{
....(500 lines MixCode Here)
}
stdafx.h includes many stable header files. MixCode here has 500 lines.
If I change just 1 line in the MixCode, I have to wait a few seconds to
compile it again.
So I want to know if there is some way to speed up this build process?
Thanks!
 
hesicong said:
I notice that compiling older C++ program with /clr option needs a lot of
time. Now I have a program below which use mix code feature in C++/CLI:
#include "stdafx.h"
#include "ManagedException.h"
class MixClass
{
....(500 lines MixCode Here)
}
stdafx.h includes many stable header files. MixCode here has 500 lines. If
I change just 1 line in the MixCode, I have to wait a few seconds to
compile it again.
So I want to know if there is some way to speed up this build process?
Thanks!

Are you using precompiled headers?

And a class with 500 members seems badly oversized. Perhaps you have
function definitions placed inline, java-style, that should be moved to a
separate .cpp file.
 
Ben Voigt said:
Are you using precompiled headers?

And a class with 500 members seems badly oversized. Perhaps you have
function definitions placed inline, java-style, that should be moved to a
separate .cpp file.


Ben, he said lines, not members.
 
Rick C said:
Ben, he said lines, not members.

C++ class definitions should have (not counting blanks and comments) one
line per member.

Any function body too long to fit on a single line should be defined outside
the class definition. Failing to do this will affect build time, which was
the original complaint. It also causes changes to cause the compiler to
reprocess code that wasn't affected. The only reason to recompile all code
using the header is if the public interface changed. Implementation changes
should only require recompiling the matching .cpp file, not users.
 
Back
Top