标题: *** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS [打印本页]

作者: 2384298858    时间: 2024-1-9 14:56
标题: *** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS


大佬们 这个问题咋解决哦
** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS

作者: 2384298858    时间: 2024-1-9 14:56
完整代码如下
#include<reg52.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
        sbit Key1=P2^0;
        sbit Key2=P2^1;
        sbit Key3=P2^2;
        sbit Key4=P2^3;
        sbit LED=P2^6;
        sbit SPK=P2^7;
        void delay(uint ms);
        uchar count,shi,ge,countdown,state;
        uchar Buf[2]={0};
        uchar code DispBitCode[] = {0xfe,0xfd};
        uchar code DispCode[] = {0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0xFF,0xBF} ;
        uchar Count=0;
        uint time=0;
        uint show_time=0;
        bit start = 0;
        bit alarm = 0;
void Delay(uint x)
{
                while(--x);
}
void DisPlay (uchar *DispBuf)
{
uchar k;
for(k=0; k<2; k++)
{
P1=DispBitCode[k];
P0=DispCode[DispBuf[k]];
Delay (500);
}
}
void KeyScan (void)
{
{
        if(Key1==0)
        {
                        delay(15);
                TR0=0;
                state=1;
        }
        if(state==1)
        {
                delay(15);
                }
}
        if(Key2==0)
                {
                                delay(15);
                        if(Key2==0)
                                {
                                                if(start==0)
                                                {
                                                                if(time<59)
                                                                                time++;
                                                                else
                                                                time=0;
                                                                show_time=time;
                                                }
                                                                while(!Key2);
                                }
                }
                                if(Key3==0)
                                {
                                delay(15);
                        if(Key3==0)
                                {
                                                if(start==0)
                                                {
                                                                if(time>0)
                                                                                time--;
                                                                else
                                                                time=59;
                                                                show_time=time;
                                                }
                                                                while(!Key3);
                                }
                }
                if(Key4==0)
                 {
                        delay(15);
                        TR0=1;
                        state=0;
                 }
}
void TimerInit (void)
{
TMOD=0x11;
TH0=(65535-50000)/256;
TL0=(65535-50000)%256;
TH1=0xfe;
TL1=0x00;
TR1=0;
ET1=1;
TR0=0;
ET0=1;
EA=1;
}
void openAlarm (void)
{
TR1=1;
LED=0;
}
void closeAlarm(void)
{
TR1 = 0;
LED=1;
}
void Time_Init()
{
LED=1;
time=10;
show_time =time;
while(1)
{
        Buf[0]= show_time%10;
        Buf[1]= show_time/10;
        DisPlay(Buf);
        KeyScan();
        if(1 == alarm)
                {
                TR0 = 0;
        openAlarm();
        }
        else
         closeAlarm();
}
return;
}
void Timer0(void) interrupt 1
{
TH0=(5535 - 50000)/256;
TL0=(65535 - 50000)%256;
count++;
if(20==Count)
{
        Count = 0;
        show_time--;
        if(0==show_time)
        {
         alarm=1;
                }
}
}
void Timerl(void) interrupt 3
{
TH1=0xfd;
TL1=0x00;
SPK=~SPK;
}
作者: 人中狼    时间: 2024-1-9 15:14
只是一个函数未调用的警告而已,不影响的
作者: 2384298858    时间: 2024-1-9 15:19
人中狼 发表于 2024-1-9 15:14
只是一个函数未调用的警告而已,不影响的

您好 Target not created. 是这个问题 就是我要构建Hex格式的文件构建不了 可以帮忙看一下吗
作者: taotie    时间: 2024-1-9 15:42
void main ()??????
作者: taotie    时间: 2024-1-9 16:00
程序从哪个函数执行??
作者: 人中狼    时间: 2024-1-9 16:09
把编译结果信息都贴出来吧
作者: 2384298858    时间: 2024-1-9 16:37
人中狼 发表于 2024-1-9 16:09
把编译结果信息都贴出来吧

Build target 'Target 1'
linking...
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
    SYMBOL:  COUNT
    MODULE:  .\Objects\main.obj (MAIN)
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
    SEGMENT: ?PR?TIMERINIT?MAIN
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
    SEGMENT: ?PR?TIME_INIT?MAIN
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
    SEGMENT: ?C_INITSEG
Program Size: data=8.2 xdata=15 code=631
Target not created.
Build Time Elapsed:  00:00:00
作者: Hephaestus    时间: 2024-1-9 16:51
void Time_Init()
这个函数你写了完整的代码。

然而没有任何地方引用过这个函数。

所以编译器不知所措,把这个函数的代码扔掉了,顺便丢给你一个警告。

作者: 1600277881    时间: 2024-1-9 18:48
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS
    SYMBOL:  COUNT
    MODULE:  .\Objects\main.obj (MAIN)
这一条是你重复定义 COUNT


其它的没问题, 因为你没调用,所以编译器告诉你这些函数不会编译
作者: Hephaestus    时间: 2024-1-9 23:07
2384298858 发表于 2024-1-9 16:37
Build target 'Target 1'
linking...
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS

所以你不要贴warning,要贴error才是问题所在。

你在你的文件里面搜“count”就知道问题在哪里了。
作者: lkc8210    时间: 2024-1-9 23:09


作者: wangxiangtan    时间: 2024-1-10 09:15
不用看Warning,要看error,
提示你变量重复定义了,你读读编译结果,不认识的单词百度一下
作者: devcang    时间: 2024-1-10 10:06
2384298858 发表于 2024-1-9 15:19
您好 Target not created. 是这个问题 就是我要构建Hex格式的文件构建不了 可以帮忙看一下吗

在项目属性中,选中创建HEX的选项
作者: joyb    时间: 2024-1-10 10:23
没有看到main




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