请帮助更正简单的MFC调试出错问题
问题1、我想问下一般的C++的代码用什么工具去调试,测试结果的?
问题2、帮我查错
下面是我用VC新建Project/Win32 Application/下的一个8.5文件夹名,An empty project
后再添加一个C++ source File,加入代码如下:
#include"iostream.h"
#define PI 3.1415926
class CPoint //定义一个点类
{
public:
CPoint(int a,int b) //只有一个有参构造函数
{x=a;
y=b;
cout < <"Construct a point object." < <endl;
}
~CPoint() //点类的析构函数
{
cout < <"Deconstruct of a point object is called." < <endl;
}
void SetPointPosition(int a,int b) //设置点位置的函数定义
{
x=a;y=b;
}
void OutPoint(); //声明点输出函数
private:
int x,y; //存放点位置的数据成员
};
void CPoint::OutPoint() //只有一个有参构造函数
{
cout < <"(" < <x < <"," < <y < <")";
}
class CCircle //定义一个圆类
{
public:
double r; //存放圆半径
CCircle() //声明圆对象的无参构造函数
{
s=r=0;
cout < <"Construct a circle object with 0 value." < <endl;
}
CCircle(double a) //声明对象的有参构造函数
{
r=a;s=0;
cout < <"Construct a circle object with a parameter." < <endl;
}
void SetValue(double a); //设置圆半径的函数声明
double CalculateArea(); //计算圆面积的函数声明
void OutCircleArea(); //输出圆面积的函数声明
~CCircle()
{
cout < <"Deconstruct of a circle object is called" < <endl;
}
protected:
double s; //存放圆的面积
};
double CCircle::CalculateArea()
{
s=r*r*PI;
return(s);
}
void CCircle::OutCircleArea()
{
cout < <"Circle Area=" < <s < <endl;
}
void CCircle::SetValue(double a)
{
r=a;s=0;
}
class CCircleInReferenceFrame:public CCircle //从基类CCircle派生创建新类
{
public:
CCircleInReferenceFrame():pt(0,0) //派生类的无参构造函数
{
cout < <"Construct a circle object in reference frame with 0 value." < <endl;
}
//下面是派生类的有参构造函数,注意对象成员和基类的构造函数调用
CCircleInReferenceFrame(double a,int x0,int y0):CCircle(a),pt(x0,y0)
{
cout < <"Construct a circle object in reference frame with parameters." < <endl;
}
~CCircleInReferenceFrame() //派生类的析构函数
{
cout < <"Deconstruct of a circle object in reference frame is called" < <endl;
}
void SetCirclePosition(int x0,int y0); //设置圆坐标系统中的位置
void OutCircleInfo();
protected:
CPoint pt; //在平面坐标系统中,圆的中心的坐标点
};
void CCircleInReferenceFrame::SetCirclePosition(int x0,int y0)
{
pt.SetPointPosition(x0,y0);
}
void CCircleInReferenceFrame::OutCircleInfo()
{
cout < <"This Circle Object is located in";
pt.OutPoint();
cout < <".\n";
CalculateArea();
OutCircleArea();
}
//下面定义主函数,在主函数中,声明平面坐标系统中的圆对象并加以应用
void main()
{
CCircleInReferenceFrame obj1(10.0,100,45),obj2;
obj1.OutCircleInfo();
obj2.SetValue(2);
obj2.SetCirclePosition(88,66);
obj2.OutCircleInfo();
}
运行时出错如下:
--------------------Configuration: 8_5 - Win32 Debug--------------------
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/8_5.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
8_5.exe - 2 error(s), 0 warning(s)
请问怎么解决