标题:
大家帮看看为什么C语言全局变量会有警告呢
[打印本页]
作者:
i66580
时间:
2020-4-11 23:02
标题:
大家帮看看为什么C语言全局变量会有警告呢
#include "stc8.h"
#include "intrins.h"
#include "lcd_lite.h"
#include "mhz.h"
#include "3231.h"
#include "h.h"
int count1=0;
int secondss=0;
void main(){
//fountion('s',y,m,d,w,h,mi,s);
int y=20;
int m=4;
int d=11;
int w=6;
int h=21;
int mi=32;
int s=30;
init();
P14=0;
Time0_Init();
show();
while(1){
EA = 0;
if(P53==0)
{fountion('s',y,m,d,w,h,mi,s);}
fountion('r',20,3,4,3,12,10,50);
LCDnum2(2,get_time(3));//week
LCDnum2(6,get_time(6));//data
LCDnum2(10,get_time(5));
LCDnum2(14,get_time(4));
LCDnum2(2+0x40,get_time(2));//time
LCDnum2(6+0x40,get_time(1));
LCDnum2(10+0x40,get_time(0));
LCDnum4(12+0x40,count1);
if(get_time(0)!=secondss){count1++;if(count1>2400)count1=0;secondss=get_time(0);}
EA = 1;}}
警告如下
Rebuild started: Project: lite
Rebuild target 'Target 1'
assembling STARTUP.A51...
compiling main.c...
compiling 3231.c...
compiling delay.c...
compiling lcd_lite.c...
compiling mhz.c...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?C_INITSEG
Program Size: data=78.0 xdata=0 code=2274
creating hex file from "lite"...
"lite" - 0 Error(s), 1 Warning(s).
Build Time Elapsed: 00:00:00
请大家帮帮忙谢谢!
作者:
csmyldl
时间:
2020-4-12 09:51
L16的警告不是涉及全局变量,而是未用到的子函数,不影响程序运行
作者:
panda_aron
时间:
2020-4-12 09:52
一般全局变量的警告是因为你定义的全局变量没有被包含,比如我在key.c里定义了一个全局变量,那么我在main里如果想要用这个变量就需要在开头加上#include"key.h",并且在key.h里添加上全局变量的定义
作者:
xxpp2011
时间:
2020-4-12 10:02
某个函数定义了没有调用到
作者:
火神浪客行
时间:
2020-4-13 10:53
这个警告不影响你正常使用,要消除把没用到的子函数注释掉就好了
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1