Theodore
Theodore

Reputation: 35

Incredibly slow compile time

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;
}

Upvotes: 2

Views: 1054

Answers (2)

the_mandrill
the_mandrill

Reputation: 30862

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

Upvotes: 2

Jive Dadson
Jive Dadson

Reputation: 17056

Use pre-compiled headers. It will be slow the first time, but after that it will breeze right through it. Include <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?

Upvotes: 0

Related Questions