8

I have recently started using Boost in my C++ projects and noticed a quite a huge delay before the compulation even starts (when I hit the re-build I have to wait for 5 minutes for compilation to start).

I have run the Filemon and it shown me that all that time the Visual Studio was idle devenv.exe was probing thru Boost include directories.

Any ideas how could I get speed the compilation up without throwing Boost away from the proect?

Thank you.

Andrew
  • 295
  • 4
  • 10
  • 1
    5 minutes seems excessive, so possibly there's something more/other than VS going through headers. but have you tried a precompiled header? Visual C++ precompiled headers are not very nice, but... – Cheers and hth. - Alf Nov 14 '10 at 23:58
  • 5 minutes is incredibly excessive. This might seem like an obvious comment but, what is the memory of the machine you're compiling on? I think something else is causing this, and I don't think it is boost. – Moo-Juice Nov 15 '10 at 00:00
  • 5
    `devenv.exe` is the Visual Studio IDE process ("development environment"). Aside from whatever scanning and parsing is required for IntelliSense, it doesn't really compile any C++. Compilation and linking is actually performed by `cl.exe`, `link.exe`, and their friends. Try disabling IntelliSense; does that help? (IntelliSense is much better in Visual Studio 2008 and is vastly improved in Visual Studio 2010). – James McNellis Nov 15 '10 at 00:01
  • 1
    how do I add it to the precompiled header? Is it just a matter of including boost headers to the stdafx.h? – Andrew Nov 15 '10 at 01:06
  • possible duplicate of [Speed up compilation in Visual Studio 2005](http://stackoverflow.com/questions/4036773/speed-up-compilation-in-visual-studio-2005) – Steve Townsend Nov 15 '10 at 01:28
  • I found the real culprit behing this slowliness... Though I should say that moving a most included Boost and Stl headers to stdafx.h helpe a lot too. Ok, the issue was a post build step which looks like this: mt /manifest "Manifest.xml" /out:"$(OutDir)\$(TargetName).manifest" /hashupdate:"$(OutDir)" Don't really know what this was for (I am embedding the manifest to my .dll but to do it I just specify that in the settings of my project), but this is exactly the bit where VS was spending 5-10 minutes each time ... Any comments? – Andrew Nov 15 '10 at 06:57
  • The Manifest was created to ensure you link against the correct version of the runtime libraries. Solved one problem whilst causing another. Precompiled headers would be a great idea if they were optional and you could build files without them if you wanted to. Getting a "fatal error" because a source file does not include stdafx.h is madness. A warning should suffice. – CashCow Nov 15 '10 at 09:57
  • @CashCow: eh, it works like your ideal situation. The fatal error you describe occurs only when you compile a file with `/Yu"stdafx.h"`. Obviously, **if** you claim that a source file should be precompiled up to "stdafx.h", then it better include it. And if you use `/Yu"KitchenSink.h"`, your source file should include KitchenSink.h. – MSalters Nov 15 '10 at 10:38
  • @Andrew: you might want to change your (own) comment into an answer to remove the question from the Unanswered list. – Michel de Ruiter Nov 17 '10 at 09:47
  • @CashCow: Adding to what MSalters said, in Visual Studio you can change the settings for individual files so that they do not use precompiled headers (or even use different ones). This can be done in the IDE by right-clicking the file and opening its Properties dialog. (It looks the same as the Project Settings dialog, but what you define in it will override those settings for the individual file.) – Leo Davidson Nov 25 '10 at 14:15
  • Using a network drive will be really slow. Compilation time for me went from ~1 minute to about ~1 second, when I switched from network share to local SSD. – Mark Lakata Apr 29 '14 at 18:12

1 Answers1

4

You probably added boost include directories straight to the 'Project Settings > C/C++ > General > Additional Include directories'. Visual Studio keeps track of project dependencies to provide a minimal recompilation when something has changed (this is not connected with IntelliSense).

If you did, move the boost includes to your VS include path - this is where they belong and they will never get checked by VS when you compile the project. If you didn't, there might be some other link to the boost dirs in the Project Settings.

Vladimir Sinenko
  • 4,629
  • 1
  • 27
  • 39