麻烦各位达人帮忙改正一个c++画图程序

daige2003 2003-10-21 01:07:34
#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
...全文
48 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
panzhaoping 2003-10-23
  • 打赏
  • 举报
回复
妈的,vc不支持tc的那一套的
它没有 #include<graphics.h>

Icre81dr 2003-10-23
  • 打赏
  • 举报
回复
VC++
hblinlin 2003-10-23
  • 打赏
  • 举报
回复
没有 #include<graphics.h>


好象是tc中有啊
daige2003 2003-10-23
  • 打赏
  • 举报
回复
tc3.0的目录为F:\tc3.0

Options/Directories
Include Directories
F:\TC3.0\INCLUDE

Library Directories
F:\TC3.0\LIB
能行吗
daige2003 2003-10-23
  • 打赏
  • 举报
回复
tc3.0的目录为F:\tc3.0

Options/Directories
Include Directories
F:\TC3.0\INCLUDE

Library Directories
F:\TC3.0\LIB
能行吗
lsAf 2003-10-21
  • 打赏
  • 举报
回复
要在编译器的编译环境里选中图形的库.例如bc3.1中的Options/Links/Library.
Andy84920 2003-10-21
  • 打赏
  • 举报
回复
#include<graphics.h>

有吗?
zhouqingyuan 2003-10-21
  • 打赏
  • 举报
回复
就是库的问题
fierygnu 2003-10-21
  • 打赏
  • 举报
回复
没有连接图形库。什么编译器?

64,636

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧