当前位置: 代码迷 >> C语言 >> C程序运行错误
  详细解决方案

C程序运行错误

热度:500   发布时间:2006-11-17 21:15:17.0
C程序运行错误

我将下面代码运行后,出现了:
"Linker Error:Undefined symbol '_Putstar' in module ZP.C"
"Linker Error:Undefined symbol '_EGAVGA_driver' in module ZP.C"
我尝试着修改一下,但发现问题实在解决不了,谁告诉我应该如何去修改定义?




#include<graphics.h>
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#define IMAGE_SIZE 10
void draw_image(int x,int y);
void Putstar(void);

main()
{
int graphdriver=DETECT;
int graphmode,color;
void *pt_addr;
int x,y,maxx,maxy,midy,midx,i;
unsigned int size;
registerbgidriver(EGAVGA_driver);
registerbgifont(TRIPLEX_FONT);
initgraph(&graphdriver,&graphmode,"");
maxx=getmaxx(); /*取得当前图形方式下允许的x最大值*/
maxy=getmaxy(); /*取得当前图形方式下允许的y最大值*/
midx=maxx/2;
x=0;
midy=y=maxy/2;
setcolor(YELLOW);
settextstyle(TRIPLEX_FONT,HORIZ_DIR,4);
settextjustify(CENTER_TEXT,CENTER_TEXT);
outtextxy(midx,400,"KEVIN LEE'S WORLD");
setbkcolor(BLACK);
setcolor(RED);
setlinestyle(SOLID_LINE,0,THICK_WIDTH);
ellipse(midx,midy,130,50,160,30);
setlinestyle(SOLID_LINE,0,THICK_WIDTH);
draw_image(x,y); /*画飞船*/
size=imagesize(x,y-IMAGE_SIZE,x+(4*IMAGE_SIZE),y+IMAGE_SIZE);
pt_addr=malloc(size);
getimage(x,y-IMAGE_SIZE,x+(4*IMAGE_SIZE),y+IMAGE_SIZE,pt_addr);
Putstar();
setcolor(WHITE); /*画星*/
setlinestyle(SOLID_LINE,0,NORM_WIDTH);
rectangle(0,0,maxx,maxy); /*画框*/
while(! kbhit())
{
Putstar();
setcolor(RED);
setlinestyle(SOLID_LINE,0,THICK_WIDTH);
ellipse(midx,midy,130,50,160,30); /*画一个围绕星球的光环*/
setcolor(BLACK);
ellipse(midx,midy,130,50,160,30);
for(i=0;i<=13;i++)
{
setcolor(i%2==0?LIGHTBLUE:BLACK);
ellipse(midx,midy,0,360,100,100-8*i); /*画星球*/
setcolor(LIGHTBLUE);
ellipse(midx,midy,0,360,100-8*i,100);
}
putimage(x,y-IMAGE_SIZE,pt_addr,XOR_PUT); /*恢复原先画面*/
x=x>=maxx?0:x+6;
putimage(x,y-IMAGE_SIZE,pt_addr,XOR_PUT); /*在另一个位置显示飞船*/
}
free(pt_addr); /*释放缓冲区空间*/
closegraph();
return;
}
void draw_image(int x,int y) /*画飞船*/
{
int arw[11];
arw[0]=x+10;arw[1]=y-10,arw[2]=x+34;arw[3]=y-6;
arw[4]=x+34;arw[5]=y+6,arw[6]=x+10;arw[3]=y+10;
arw[9]=x+10;arw[10]=y-10;
moveto(x+10,y-4);
setcolor(14);
setfillstyle(1,4);
linerel(-3*10,-2*8); /*画尾部本线*/
moveto(x+10,y+4);
linerel(-3*10,+2*8);
moveto(x+10,y);
linerel(-3*10,0);
setcolor(3);
setfillstyle(1,LIGHTBLUE);
fillpoly(4,arw); /*画飞船天体*/
}
void Pustar(void) /*画星*/
{
int seed=1858;
int i,dotx,doty,h,w,color,maxcolor;
maxcolor=getmaxcolor(); /*得到当前模式下,最大颜色函数*/
w=getmaxx();
h=getmaxy();
srand(seed);
for(i=0;i<250;++i)
{
dotx=1+random(w-1);
doty=1+random(h-1);
color=random(maxcolor);
setcolor(color); /*用点表示小星*/
putpixel(dotx,doty,color); /*用小圆表示星*/
circle(dotx+1,doty+1,1);
}
srand(seed);
}

搜索更多相关的解决方案: int  void  include  Linker  

----------------解决方案--------------------------------------------------------
头疼~谁来帮我解决下错误?
----------------解决方案--------------------------------------------------------
应该连接外部库文件吧

如果我没记错,好象_EGAVGA_driver 与 _Putstar
是在一个图形LIB库中的定义

[此贴子已经被作者于2006-11-24 21:08:23编辑过]


----------------解决方案--------------------------------------------------------
  相关解决方案