visual studio 2012 compile times

Possible Duplicate:
Why does C++ compilation take so long?
Visual studio 2012 slow compile time

I'm using visual studio 2012 and the time it takes to compile is way to long. About 20 seconds just for a measly 50 lines of code. I thought it was my computers fault but c# compiles fine on it just not c++. I know that c++ takes longer to compile but 20 seconds is ridiculous.

Here's the code I'm trying to compile which takes about 20 seconds to compile.

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

I've compiled this piece of code under my installation of VS2012 and it took about 3 seconds to build a project with this only file. Probably, you have troubles in your VS2012 installation. Try running it in safe mode to disable extensions.

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

上一篇: 为什么编译速度在C ++和C#中有很大不同?

下一篇: visual studio 2012编译时间