当前位置: 代码迷 >> C语言 >> 时钟显示程序出错帮忙看看!
  详细解决方案

时钟显示程序出错帮忙看看!

热度:690   发布时间:2008-04-28 11:06:06.0
时钟显示程序出错帮忙看看!
void main(void)
{

P1=0xff;
P3=0xff;
initial1();
delay();
uchar h1,h2,m1,m2,s1,s2;
h1=h2=m1=m2=s1=s2=0;
uint s;
while(1)
{

for(s=0;s<60;s++)
{
s1++;

if(s1>9){s1=0;s2++;}
if(s2>6){s2=0;m1++;}
if(m1>9){m1=0;m2++;}
if(m2>6){m2=0;h1++;}
if(h1>9){h1=0;h2++;}
if(h2>2){h2=0;}
delay();
display(s1,0);
display(s2,2);
display(m1,4);
display(m2,6);
display(h1,8);
display(h2,10);
}

}
}

出错信息如下:F:\程序\1621时钟\1621.C(128): error C141: syntax error near 'unsigned'
F:\程序\1621时钟\1621.C(128): error C202: 'h1': undefined identifier
F:\程序\1621时钟\1621.C(129): error C141: syntax error near 'unsigned'
F:\程序\1621时钟\1621.C(129): error C202: 'h2': undefined identifier
F:\程序\1621时钟\1621.C(130): error C141: syntax error near 'unsigned'
F:\程序\1621时钟\1621.C(130): error C202: 'm1': undefined identifier
F:\程序\1621时钟\1621.C(131): error C141: syntax error near 'unsigned'
F:\程序\1621时钟\1621.C(131): error C202: 'm2': undefined identifier
F:\程序\1621时钟\1621.C(132): error C141: syntax error near 'unsigned'
F:\程序\1621时钟\1621.C(132): error C202: 's1': undefined identifier
F:\程序\1621时钟\1621.C(133): error C141: syntax error near 'unsigned'
F:\程序\1621时钟\1621.C(133): error C202: 's2': undefined identifier
F:\程序\1621时钟\1621.C(134): error C141: syntax error near 'unsigned'
F:\程序\1621时钟\1621.C(134): error C202: 's': undefined identifier
F:\程序\1621时钟\1621.C(138): error C202: 's': undefined identifier
F:\程序\1621时钟\1621.C(140): error C202: 's1': undefined identifier
F:\程序\1621时钟\1621.C(142): error C202: 's1': undefined identifier
F:\程序\1621时钟\1621.C(142): error C202: 's1': undefined identifier
F:\程序\1621时钟\1621.C(142): error C202: 's2': undefined identifier
F:\程序\1621时钟\1621.C(143): error C202: 's2': undefined identifier
F:\程序\1621时钟\1621.C(143): error C202: 's2': undefined identifier
F:\程序\1621时钟\1621.C(143): error C202: 'm1': undefined identifier
F:\程序\1621时钟\1621.C(144): error C202: 'm1': undefined identifier
F:\程序\1621时钟\1621.C(144): error C202: 'm1': undefined identifier
F:\程序\1621时钟\1621.C(144): error C202: 'm2': undefined identifier
F:\程序\1621时钟\1621.C(145): error C202: 'm2': undefined identifier
F:\程序\1621时钟\1621.C(145): error C202: 'm2': undefined identifier
F:\程序\1621时钟\1621.C(145): error C202: 'h1': undefined identifier
F:\程序\1621时钟\1621.C(146): error C202: 'h1': undefined identifier
F:\程序\1621时钟\1621.C(146): error C202: 'h1': undefined identifier
F:\程序\1621时钟\1621.C(146): error C202: 'h2': undefined identifier
F:\程序\1621时钟\1621.C(147): error C202: 'h2': undefined identifier
F:\程序\1621时钟\1621.C(147): error C202: 'h2': undefined identifier
F:\程序\1621时钟\1621.C(149): error C202: 's1': undefined identifier
F:\程序\1621时钟\1621.C(150): error C202: 's2': undefined identifier
F:\程序\1621时钟\1621.C(151): error C202: 'm1': undefined identifier
F:\程序\1621时钟\1621.C(152): error C202: 'm2': undefined identifier
F:\程序\1621时钟\1621.C(153): error C202: 'h1': undefined identifier
F:\程序\1621时钟\1621.C(154): error C202: 'h2': undefined identifier



帮帮忙吧@
搜索更多相关的解决方案: 时钟  display  void  

----------------解决方案--------------------------------------------------------
把定义变量的语句提到main的开始处去
----------------解决方案--------------------------------------------------------
谢谢啦  成功了!!。。。
----------------解决方案--------------------------------------------------------
  相关解决方案