找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

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

Keil C語言編譯錯誤C202 C231代碼未定義

[復制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:127167 發(fā)表于 2021-9-1 22:20 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
#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ā)
ID:213173 發(fā)表于 2021-9-2 06:02 | 只看該作者
抄錯了
#include<reg52.h>
//#define uint uigned int
#define uint unsigned int
#define uchar unsigned char
void delay(uint);
回復

使用道具 舉報

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

使用道具 舉報

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

可以呀!這C學到家了。
回復

使用道具 舉報

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

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

使用道具 舉報

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

謝謝總工
回復

使用道具 舉報

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

謝謝您的建議  
回復

使用道具 舉報

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

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

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

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

快速回復 返回頂部 返回列表