Pre-Compiled Headers

in Help Center
Hello,
Ice 2.1.1
Visual C++ .NET 2003 (7.1)
I'm in the process of configure my project to use Pre-Compiled Headers to improve build speed.
I have a problem with the compiled generated files with slice2cpp because it doesn't include the precompiled header file (i.e: #include "precompiled.h") and the C++ compiler raises an error.
I haven't see any command line option in slice2cpp to include a precompiled header file.
What's your advice to this problem? Sure I can include this file with a script after compiling the slice file but, are there other solution?
Thank you all for your time and help!
Mario
Ice 2.1.1
Visual C++ .NET 2003 (7.1)
I'm in the process of configure my project to use Pre-Compiled Headers to improve build speed.
I have a problem with the compiled generated files with slice2cpp because it doesn't include the precompiled header file (i.e: #include "precompiled.h") and the C++ compiler raises an error.
I haven't see any command line option in slice2cpp to include a precompiled header file.
What's your advice to this problem? Sure I can include this file with a script after compiling the slice file but, are there other solution?
Thank you all for your time and help!
Mario
0
Comments
Cheers,
Michi.
I assume that you want to use precompiled headers manually? If so, could you explain why? I tried using the /YX option, which causes the compiler to use precompiled headers automatically. With that, no source code changes are necessary, and build times improve somewhat.
No, there is no such option. We could add one, but I'd have to be convinced of its usefulness first.
Why not just enable automatic precompiled headers? That way, you don't have to change anything in the code.
(As an aside, I believe that any approach that requires source code changes in order to use precompiled headers is fundamentally broken -- it should be the compiler's job to figure out what needs recompiling, not the programmer's.)
Cheers,
Michi.
The "automatic precompiled headers" option in MSVC is very inefficient, not only the improvement are very low but, unless you are exquisitely careful, this "automatic" use of precompiled headers translates to "rebuilding the precompiled headers for every source file."
You can read about this at Bruce Dawson's paper. Also in Games from Within by Noel Llopis there're some articles about this subject.
For example, in one of my projects my rebuild times went from roughly 40 secs. to 11 secs!
Yes, I agree absolutelly with this but, almost in MSVC, there isn't another solution for this...
Thanks,
Mario
You can make use of two strategies:
Regards
Mario
I'm not sure you want to generate PCHs automatically for project files... If I read your post right, and you only want to avoid the C1010 compilation error, can't you simply specify Not Using Precompiled Headers under the compilation unit properties?
HTH
This being my first post, I also wanted to say "well done" to ZeroC. Forgive the gushing, but Ice is some very cool middleware: great feature set and language coverage, brilliant documentation, and with an API that makes me feel like I should be working harder (as opposed to CORBA, which only taught me some new profanities). Looking forward to Ice-Grid...
The next version of Ice will allow you inject the appropriate #include directives into the generated code, so you can use precompiled headers if you wish.
Cheers,
Michi.
In fact, I use maybe a better and simpler way to solve this problem.
I write a cpp file, which include the to precompile header file and the cpp ice generated. It looks like this:
#include "precompile.h"
#include "ice_gen1.cpp"
#include "ice_gen2.cpp"
It works very well. I don't need to do any extra thing.
Regards,
Yomi
The problem with this approach is that if one cpp file is modified, all the rest will be compiled too. This conflicts with using pre-compiled headers to accelerate compile times for incremental builds.
Regards,
Mario