標(biāo)題:
編譯時(shí)提示: MAIN.C(17): error C141: syntax error near 'void' 請(qǐng)大俠指正(...
[打印本頁]
作者:
云游者
時(shí)間:
2018-1-14 23:17
標(biāo)題:
編譯時(shí)提示: MAIN.C(17): error C141: syntax error near 'void' 請(qǐng)大俠指正(...
#include<reg51.h>
sbit P1_0=P1^0;
sbit P1_1=P1^1;
sbit P1_2=P1^2;
sbit P1_3=P1^3;
sbit P1_4=P1^4;
sbit P1_5=P1^5;
sbit P1_6=P1^6;
sbit P1_7=P1^7;
void Delay(unsigned char a)
{
unsigned char i;
while(--a !=0)
{
for(i=0;i<125;i++); //一個(gè) ; 表示空語句,CPU空轉(zhuǎn)。
} //i 從0加到125,CPU大概就耗時(shí)1毫秒 }
void main()
{
while(1)
{
P1_0=0;
Delay(100);
P1_0=1;
P1_1=0;
Delay(100);
P1_1=1;
P1_2=0;
Delay(100);
P1_2=1;
P1_3=0;
Delay(100);
P1_3=1;
P1_4=0;
Delay(100);
P1_4=1;
P1_5=0;
Delay(100);
P1_5=1;
P1_6=0;
Delay(100);
P1_6=1;
P1_7=0;
Delay(100);
P1_7=1;
}
}
}
編譯時(shí)提示: MAIN.C(17): error C141: syntax error near 'void' 請(qǐng)大俠指正(紅字處)。
作者:
cjjcjj1
時(shí)間:
2018-1-15 00:16
提示:
作者被禁止或刪除 內(nèi)容自動(dòng)屏蔽
作者:
999333
時(shí)間:
2018-1-15 00:20
把#//i 從0加到125,CPU大概就耗時(shí)1毫秒 }最后的括號(hào)放到下面,在void main()的下面加“}”就沒問題了,注意點(diǎn)括號(hào)就行了
作者:
lhl139679
時(shí)間:
2018-1-15 09:28
main函數(shù)不能放于其他函數(shù)之中
作者:
ahshmj
時(shí)間:
2018-1-15 09:58
有一個(gè)大括弧被你注釋掉了。所以少了一個(gè)大括弧。
作者:
cccc888
時(shí)間:
2018-1-15 12:42
注釋掉一個(gè)花括號(hào),結(jié)尾又多了一個(gè)括號(hào)。代碼整理了下。
作者:
云游者
時(shí)間:
2018-1-15 21:19
謝謝大家,都是大俠!能編譯了
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1