在vc6中,我在graph.h中定義了雷的結構體,在.cpp中寫了以下兩個方法,可是編譯的時候,提示說thunder沒有定義,請問這是怎么回事?我的其他結構體都不會報錯的。
還有,我用graphics.h的庫函式circle(int,int,int)畫圓,可是編譯時提示引數錯誤。謝謝大神們
C:\Program Files\Microsoft Visual Studio\MyProjects\colorfulRain\colorfulRain.cpp(19) : error C2872: 'circle' : ambiguous symbol
C:\Program Files\Microsoft Visual Studio\MyProjects\colorfulRain\colorfulRain.cpp(19) : error C2661: 'circle::circle' : no overloaded function takes 3 parameters
C:\Program Files\Microsoft Visual Studio\MyProjects\colorfulRain\colorfulRain.cpp(109) : error C2027: use of undefined type 'thunder'
struct thunder{//雷
int X1;//坐標1
int Y1;//坐標1
int X2;//坐標2
int Y2;//坐標2
int X3;//坐標3
int Y3;//坐標3
int X4;//坐標4
int Y4;//坐標4
struct thunder *next;//下一個雷
};
#graphics.h
struct thunder *makethunder(){
struct thunder *p;
p=(struct thunder*)malloc(sizeof(struct thunder));
p->X1=random(640);
p->Y1=random(300);
p->X2=p->X1-random(20);
p->Y2=p->Y1+random(20);
p->X3=p->X2+random(20);
p->Y3=p->Y2+random(15);
p->X4=p->X3-random(20);
p->Y4=p->Y3+random(30);
}
void drawthunder(struct thunder *p){
setcolor(WHITE);
line(p->X1,p->Y1,p->X2,p->Y2);
line(p->X2,p->Y2,p->X3,p->Y3);
line(p->X3,p->Y3,p->X4,p->Y4);
}
uj5u.com熱心網友回復:
graphics.h是第三方的庫嗎?轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/67668.html
標籤:基礎類
上一篇:矩陣轉置
