首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

c++编程异常,多谢··小弟我想学习学习···

2012-06-22 
求助c++编程错误,谢谢我想学习学习错误为error LNK2001: unresolved external symbol public: void __thi

求助c++编程错误,谢谢··我想学习学习···
错误为error LNK2001: unresolved external symbol "public: void __thiscall Rectangle::print(void)" (?print@Rectangle@@QAEXXZ)
Debug/22.exe : fatal error LNK1120: 1 unresolved externals
#include<iostream>
using namespace std;
class Rectangle
{
public:
Rectangle(double l=3,double w=5);
~Rectangle()
{
cout<<"count:"<<count;
}
double area();
void display();
void print();
static int count;
private:
double length;
double width;
};
Rectangle::Rectangle(double l,double w)
{
length=l;
width=w;
count++;
}
double Rectangle::area()
{
return(length*width);
}
void Rectangle::display()
{
cout<<"Input length,width:"<<endl;
cin>>length>>width;
}
int Rectangle::count=0;
int main()
{
Rectangle r1(4,9),r2;
r2.display();
r2.print();
r1.print();
  return 0;
}

[解决办法]

C/C++ code
void print();//只有声明,没有定义 

热点排行