| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 624 人关注过本帖
标题:[求助]请看一下这个错误怎么纠正
只看楼主 加入收藏
zhulei1978
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:53
帖 子:1351
专家分:1200
注 册:2006-12-17
结帖率:100%
收藏
 问题点数:0 回复次数:4 
[求助]请看一下这个错误怎么纠正

point.h:
enum Boolean {false, true};
class Location {
protected: // allows derived class to access private data
int X;
int Y;
public: // these functions can be accessed from outside
Location(int InitX, int InitY);
int GetX();
int GetY();
};
class Point : public Location {
protected:
Boolean Visible; // classes derived from Point will need access
public:
Point(int InitX, int InitY); // constructor
void Show();
void Hide();
Boolean IsVisible();
void MoveTo(int NewX, int NewY);
};
////////////////////////////////////////////////////////////////////////////////
circle.cpp:
#include <graphics.h> // graphics library declarations
#include "point.h" // Location and Point class declarations
#include <conio.h> // for getch() function

class Circle : Point { // derived privately from class Point
// and ultimately from class Location
int Radius; // private by default

public:
Circle(int InitX, int InitY, int InitRadius);
void Show(void);
void Hide(void);
void Expand(int ExpandBy);
void MoveTo(int NewX, int NewY);
void Contract(int ContractBy);
};

Circle::Circle(int InitX, int InitY, int InitRadius) : Point(InitX,InitY)
{
Radius = InitRadius;
};

void Circle::Show(void)
{
Visible = true;
circle(X, Y, Radius); // draw the circle
}

void Circle::Hide(void)
{
unsigned int TempColor; // to save current color
TempColor = getcolor(); // set to current color
setcolor(getbkcolor()); // set drawing color to background
Visible = false;
circle(X, Y, Radius); // draw in background color to erase
setcolor(TempColor); // set color back to current color
};

void Circle::Expand(int ExpandBy)
{
Hide(); // erase old circle
Radius += ExpandBy; // expand radius
if (Radius < 0) // avoid negative radius
Radius = 0;
Show(); // draw new circle
};

void Circle::Contract(int ContractBy)
{
Expand(-ContractBy); // redraws with (Radius - ContractBy)
};

void Circle::MoveTo(int NewX, int NewY)
{
Hide(); // erase old circle
X = NewX; // set new location
Y = NewY;
Show(); // draw in new location
};

main() // test the functions
{
// initialize the graphics system
int graphdriver = DETECT, graphmode;
initgraph(&graphdriver, &graphmode, "..\\bgi");

Circle MyCircle(100, 200, 50); // declare a circle object
MyCircle.Show(); // show it
getch(); // wait for keypress
MyCircle.MoveTo(200, 250); // move the circle (tests hide
// and show also)
getch();
MyCircle.Expand(50); // make it bigger
getch();
MyCircle.Contract(75); // make it smaller
getch();
closegraph();
return 0;
}
错误提示:
Linking CIRCLE.EXE:
Linker Error: Undefined symbol _closegraph in module CIRCLE.CPP
Linker Error: Undefined symbol _initgraph in module CIRCLE.CPP
Linker Error: Undefined symbol _setcolor in module CIRCLE.CPP
Linker Error: Undefined symbol _circle in module CIRCLE.CPP
Linker Error: Undefined symbol _getbkcolor in module CIRCLE.CPP
Linker Error: Undefined symbol _getcolor in module CIRCLE.CPP
Linker Error: Undefined symbol Point::Point(int,int) in module CIRCLE.CPP
谢谢

搜索更多相关主题的帖子: private classes derived outside access 
2007-03-27 22:33
zhulei1978
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:53
帖 子:1351
专家分:1200
注 册:2006-12-17
收藏
得分:0 
这个就是tc编译器example文件夹下面的例子,但是编译不能通过。大家帮忙看看。

[此贴子已经被作者于2007-3-27 22:53:09编辑过]



其实我就是改变社会风气,提高少女素质,刺激电影市道,提高年轻人内涵,玉树临风,风度翩翩的整蛊专家,我名叫古晶,英文名叫JingKoo!
2007-03-27 22:52
yuyunliuhen
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:1435
专家分:0
注 册:2005-12-12
收藏
得分:0 
代码都在这了吗?有这个'graphics.h'头文件吗?

Go confidently in the  directions of your dreams,live the life you have imagined!Just do it!
It is no use learning without thinking!
2007-03-27 23:17
zhulei1978
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:53
帖 子:1351
专家分:1200
注 册:2006-12-17
收藏
得分:0 
graphics.h是系统定义的头文件

其实我就是改变社会风气,提高少女素质,刺激电影市道,提高年轻人内涵,玉树临风,风度翩翩的整蛊专家,我名叫古晶,英文名叫JingKoo!
2007-03-28 11:32
wfpb
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:2188
专家分:0
注 册:2006-4-2
收藏
得分:0 

<graphics.h>是TC里面的图形库,如果要用的话应该用TC来编译,VC++有他自己的另外图形库!


[glow=255,red,2]wfpb的部落格[/glow] 学习成为生活的重要组成部分!
2007-03-28 13:11
快速回复:[求助]请看一下这个错误怎么纠正
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025566 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved