标题: 求解啊错误是TEXT4.C(5): error C129: missing ';' before 'k' 怎么改啊 [打印本页]

作者: 奥哦    时间: 2016-6-30 11:25
标题: 求解啊错误是TEXT4.C(5): error C129: missing ';' before 'k' 怎么改啊
#include<reg51.h>
#define uint unsigned int; uint k;
sbit D1=P1^0;
uint k;
void main(void)
{uint k=0;TMOD=0x20;
while(1){while(!TF1);TF1=0;
while(++==2000){D1=!D1;k=0;}}}

START:        JB P1.0, NEXT1        ;P1.0=0,左转灯亮
        SETB P1.7
        CLR P1.6       
        ACALL DELAY
        SETB P1.6               
        ACALL DELAY
       
NEXT1:        JB P1.1,NEXT2        ;P1.1=0,右转灯亮
        SETB P1.6
        CLR P1.7       
        ACALL DELAY
        SETB P1.7
        ACALL DELAY

NEXT2:        SETB P1.6        ;P1.0=1、P1.1=1转向灯熄灭
        SETB P1.7       
        SJMP  START

;延时500ms
DELAY:        MOV R1,#5
L1:        MOV R2,#200
L2:        MOV R3,#250
        DJNZ R3,$
        DJNZ R2,L2
        DJNZ R1,L1
        RET

        END  
错误是TEXT4.C(5): error C129: missing ';' before 'k' 怎么改啊


作者: dpj蜗牛    时间: 2016-6-30 12:26
把第四行删掉,与第二行重复定义
作者: 奥哦    时间: 2016-6-30 12:37
改了以后还有错啊

作者: 奥哦    时间: 2016-6-30 12:38
TEXT4.C(5): error C141: syntax error near '{' 还有 TEXT4.C(5): error C129: missing ';' before 'k'
作者: dpj蜗牛    时间: 2016-6-30 17:10
把第二行 改成 #define uint unsigned int   后面的符号不要。 把 uint k;  另起一行
作者: ahshmj    时间: 2016-6-30 19:41
c 和 汇编 混合不是这样的。
作者: hellowhl    时间: 2016-7-1 09:35
第二行宏定义不规范,程序最好一行一行的写,5楼说的对,宏定义这样写#define uint unsigned int 然后其他另外一行
作者: geminiguy_07    时间: 2016-7-1 11:43
应该将#define uint unsigned int; uint k;改为#define uint unsigned int

作者: liuyimao485812    时间: 2016-7-1 18:16
语法错误。
作者: zl2168    时间: 2016-7-1 21:08
liuyimao485812 发表于 2016-7-1 18:16
语法错误。

错在哪里啊?凡是keil编译出错,都是语法错误,不用说废话。




欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1