麻烦各位达人帮忙改正一个c++画图程序
#include<iostream.h>
#include<conio.h>
#include<graphics.h>
class Location
{
protected:
int X;
int Y;
public:
Location(int InitX,int InitY);
int GetX();
int GetY();
};
class Point: public Location
{
public:
Point(int InitX,int InitY);
void Show(int pixelcolor);
};
Location::Location(int InitX,int InitY)
{
X=InitX;
Y=InitY;
}
int Location::GetX(void)
{
return X;
}
int Location::GetY(void)
{
return Y;
}
Point::Point(int InitX,int InitY):Location(InitX,InitY)
{}
void Point::Show(int pixelcolor=15)
{
int j;
j=pixelcolor;
putpixel(X,Y,j);
}
void main()
{
int GraphDriver=DETECT,GraphMode;
Point b(40,20);
Point c(100,200);
initgraph(&GraphDriver,&GraphMode,"F:\\tc3.0\\BGI");
b.Show();
c.Show();
getch();
cout<<"GetX()="<<b.GetX()<<endl;
cout<<"GetY()="<<b.GetY()<<endl;
cout<<"GetX()="<<c.GetX()<<endl;
cout<<"GetY()="<<c.GetY()<<endl;
closegraph();
}
编译后的错误:
Linker Error: Undefined symbol _closegraph in module NONAME26.CPP
Linker Error: Undefined symbol _initgraph in module NONAME26.CPP
Linker Error: Undefined symbol _putpixel in module NONAME26.CPP