2

I thought I might try out Visual Studio 2012 so I created a simple console 'hello world' application that makes a beep noise whenever it is run, but when I went to compile it it took 25 seconds. Now I know for a fact that the simplest of 'hello world' programs, on a modern system with 3.2gHz of i7 shouldn't take that long to compile. Is there a setting or feature that I could disable that was added in 2012 that made compiling basic console apps incredibly slow?

#include <iostream>
using namespace std;

string returnvalue;

int main()
{
    cout << "Hello World\a";
    return 0;
}
Theodore
  • 35
  • 5
  • is that `string returnvalue` supposed to be in the `main()` function? – IT Ninja Dec 20 '12 at 03:23
  • As an experiment, try temporarily disabling your anti-virus software or adding an exclusion in it for the C++ project directory. I had issues with Microsoft Security Essentials' real-time protection causing slow and/or failed builds with MSVC2010. – Blastfurnace Dec 20 '12 at 03:35
  • @ITNinja That was a remnant piece of code that I meant to delete a while ago. I did just then and the compile time was still the same. – Theodore Dec 20 '12 at 03:42
  • @Blastfurnace I just tried that but to no avail. I'm going to try and reinstall it and see if that helps. – Theodore Dec 20 '12 at 03:44

2 Answers2

2

This sounds like there's something else on your system that is interfering with the compilation, as a single file like this should only take about a second to build. I would suggest running Process Monitor while doing a build and then look at the summaries in Tools -> Process Activity Summary/File Summary. It's likely that it'll point to the problem on your system which may be something like:

  • Virus/spyware scanner or some other process that hooks into all the file accesses. Desktop search tools do this too.
  • Permissions problem where a file or directory can't be read or written
  • Accessing files on a network drive which may be unavailable
  • Other network communication with servers that may not be available
the_mandrill
  • 29,792
  • 6
  • 64
  • 93
  • Hah! I found some dodgy looking program called "Browser Manager" in program data. I uninstalled it and now my compiles are flawless – Theodore Dec 20 '12 at 10:37
  • 1
    Aha! Sounds nasty: http://guides.yoosecurity.com/how-to-remove-browser-manager-virus-manaually-and-completely/ – the_mandrill Dec 20 '12 at 12:50
0

Use pre-compiled headers. It will be slow the first time, but after that it will breeze right through it. Include &LT;iostream> in your pre-compiled header .h file.

The easiest way would be to start over and use the default configuration, which uses pre-compiled headers. Or...

See here for how to add precompiled headers to an existing project: How to fix .pch file missing on build?

Community
  • 1
  • 1
Jive Dadson
  • 16,680
  • 9
  • 52
  • 65
  • 1
    PCH files will have a positive effect on large projects (or rebuilds once you've built for the first time). I can't think it would have much effect on a project with just one minimal file – the_mandrill Dec 20 '12 at 09:25
  • @the_mandrill An innocent looking header can pull in scads of stuff. – Jive Dadson Dec 20 '12 at 17:28