Visual studio 2012 slow compile time

I have an extremely small project in visual studio 2012 (only 50 lines of code). I only have one source file ( main.cpp ). But yet it takes about 20 seconds or more to compile! How am I supposed to speed it up? When I use C# the compile times are fast but when it comes to C++ it's super slow.

As for my minimal computer specs, I have an i5 processor, 4gb of ram and it is a quad core. It shouldn't be taking this long to compile something that is only 50 lines long. What should I do?

My Code:

    #include<iostream>
using namespace std;

class Entity
{
protected: 
    int health; 
public: 
    void SetHealth(int value)
    {
        health = value;
    }

    void DisplayHealth()
    {
        cout << "Entity: " << health << endl;
    }
};

class Player : public Entity
{
private:
    int xp;
public: 
    void DisplayHealth()
    {
        cout << "Player: " << health << endl;
    }
};

class Enemy : public Entity
{

};

int main()
{
    Player player; 

    Entity *entity = &player;

    entity->SetHealth(10); 
    player.DisplayHealth();

    system("pause");
    return 0;
}

The code is not using anything that can make the compiler sweat.

Some options that might hold up performance: clear %localappdata%MicrosoftWebSiteCache Also clear out %localappdata%temp folder.

Unplug your n/w cable and try (or turn of wireless connection).

Also in toolsoptionsdebugging: disable edit and continue. you might be generating MAP, PDB etc... See what you need and what you don't.

Some people have reported that turning of "hardware acceleration' helps (options)!

Check your PCH (pre compiled header file) and see if it has grown too big.

Allow incremental linking so that everthing is not being built all the time.

Also, ensure that the disk is not fragmented.

链接地址: http://www.djcxy.com/p/85406.html

上一篇: C ++编程风格

下一篇: Visual Studio 2012编译时间很慢