找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 3149|回復(fù): 7
打印 上一主題 下一主題
收起左側(cè)

Keil C語(yǔ)言編譯錯(cuò)誤C202 C231代碼未定義

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:127167 發(fā)表于 2021-9-1 22:20 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
#include<reg52.h>
#define uint uigned int
#define uint unsigned int
#define uchar unsigned charvoid delay(uint);
sbit D0=P1^0;
sbit D1=P1^1;
sbit D2=P1^2;
sbit D3=P1^3;
sbit D4=P1^4;
sbit D5=P1^5;
sbit D6=P1^6;
sbit D7=P1^7;
void main()   
{   
while(1)        
{        
D0=0;        
delay(600);        
D1=0;        
delay(600);        
D2=0;        
delay(600);        
D3=0;        
delay(600);        
D4=0;        
delay(600);        
D5=0;        
delay(600);        
D6=0;        
delay(600);        
D7=0;        
delay(600);            
}   
}
void
delay(uint z)   
{   
uint x,y;   
for(x=100;x>0;x--)        
{        
for(y=z;y>0;y--)            
{            
}        
}   
}
P.C(41): error C202: 'y': undefined identifier
P.C(45): error C231: 'delay': redefinition
p.c - 8 Error(s), 2 Warning(s).



分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

沙發(fā)
ID:213173 發(fā)表于 2021-9-2 06:02 | 只看該作者
抄錯(cuò)了
#include<reg52.h>
//#define uint uigned int
#define uint unsigned int
#define uchar unsigned char
void delay(uint);
回復(fù)

使用道具 舉報(bào)

板凳
ID:94031 發(fā)表于 2021-9-2 07:10 | 只看該作者
#define uint uigned int 應(yīng)該 #define uint unsigned int,uigned 錯(cuò)。
回復(fù)

使用道具 舉報(bào)

地板
ID:584195 發(fā)表于 2021-9-2 07:28 | 只看該作者
xuyaqi 發(fā)表于 2021-9-2 07:10
#define uint uigned int 應(yīng)該 #define uint unsigned int,uigned 錯(cuò)。

可以呀!這C學(xué)到家了。
回復(fù)

使用道具 舉報(bào)

5#
ID:624769 發(fā)表于 2021-9-2 20:06 | 只看該作者
#define uchar unsigned charvoid delay(uint);
這里少了回車(chē),
#define uchar unsigned char
void delay(uint);
就可以了,

另外,最好用typedef 不要用 define (僅僅建議)
回復(fù)

使用道具 舉報(bào)

6#
ID:127167 發(fā)表于 2021-9-4 20:56 | 只看該作者
wulin 發(fā)表于 2021-9-2 06:02
抄錯(cuò)了
#include
//#define uint uigned int

謝謝總工
回復(fù)

使用道具 舉報(bào)

7#
ID:127167 發(fā)表于 2021-9-4 20:57 | 只看該作者
188610329 發(fā)表于 2021-9-2 20:06
#define uchar unsigned charvoid delay(uint);
這里少了回車(chē),
#define uchar unsigned char

謝謝您的建議  
回復(fù)

使用道具 舉報(bào)

8#
ID:127167 發(fā)表于 2021-9-4 21:06 | 只看該作者
wulin 發(fā)表于 2021-9-2 06:02
抄錯(cuò)了
#include
//#define uint uigned int

謝謝您 現(xiàn)在可以
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表