看看程序错哪了

看看程序哪里错了
求助下 帮我看看程序哪里错了
[code=C/C++][/code]
#include<iostream>
using namespace std;
class dog
{
public:
void set(int g,double w);
dog(int g=0,double w=5);
~dog();
int getage()
{
return age;
}
double getweight()
{
return weight;
}


private:
int age;
double weight;
};

dog::dog(int g,double w)
{ age=g;
weight=w;
}



dog::~dog()
{
}



int main()
{
dog jack(2,10);
cout<<"jack is a dog who is ";
cout<<jack.getage()<<"years old and "<<jack.getweight<<"pound weight"<<endl;
jack.set(7,20);
cout<<"now jack is ";
cout<<jack.getage()<<"years old and "<<jack.getweight<<"pound weight"<<endl;

return 0;
}


老运行不过出现
Linking...
4-8 dog.obj : error LNK2005: _main already defined in 4-8 dog 2.obj
4-8 dog.obj : error LNK2001: unresolved external symbol "public: void __thiscall dog::set(int,double)" (?set@dog@@QAEXHN@Z)
Debug/4-8 dog 2.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.


------解决方案--------------------
void set(int g,double w);

set成员函数,你没实现,就用了
------解决方案--------------------


#include<iostream>
using namespace std;
class dog
{
public:
void set(int g,double w){age=g,weight=w;}
dog(int g=0,double w=5);
~dog();
int getage()
{
return age;
}
double getweight()
{
return weight;
}


private:
int age;
double weight;
};

dog::dog(int g,double w)
{ age=g;
weight=w;
}



dog::~dog()
{
}



int main()
{
dog jack(2,10);
cout<<"jack is a dog who is ";
cout<<jack.getage()<<"years old and "<<jack.getweight()<<"pound weight"<<endl;
jack.set(7,20);
cout<<"now jack is ";
cout<<jack.getage()<<"years old and "<<jack.getweight()<<"pound weight"<<endl;

return 0;
}