winnie 发表于 2009-3-24 13:46:42

我在MPLAB IDE6.4编译如下程序,老有BUILD FAILED!,不知为何?

#include      <stdlib.h>
#include <pic.h>
#include      <math.h>
#defineuchar unsigned char
ustep(unsigned int x,unsigned y)
{ unsigned int n;
n=834/abs(x-y);
if(n==0)
   n=1;
   else if(n>255)
   n=255;
return(n);
}

main()
{   uchar m;
    m=ustep(1001,1000);
}
编译后的信息如下,且无法调试。
Executing: "d:\htsoft\ht-pic\BIN\PICC.EXE" -C -E"ABS.cce" "ABS.C" -O"ABS.obj" -I"D:\HTSOFT\HT-PIC\include" -Q -MPLAB -16C925 -D32 -Zg6 -O -W6
HI-TECH PICC COMPILER (Microchip PIC) V8.01 PL1
Copyright (C) 1984-2002 HI-TECH SOFTWARE
Serial number: HCPIC-00001
Licensed to: C WJ
Executing: "d:\htsoft\ht-pic\BIN\PICC.EXE" -E"cv9-pridecc.lde" "E:\11sh\picctry\CV9PART\ABS.obj" -Q -MPLAB -16C925 -D32 -LL -PSECTMAP -W6 -O"cv9-pridecc.cof" -O"cv9-pridecc.hex"
HI-TECH PICC COMPILER (Microchip PIC) V8.01 PL1
Copyright (C) 1984-2002 HI-TECH SOFTWARE
Serial number: HCPIC-00001
Licensed to: C WJ
Psect Usage Map:
Psect    | Contents               | Memory Range
---------|--------------------------|--------------------
powerup| Power on reset code      | $0000 - $0003
end_init | Initialization code      | $0004 - $0006
text0    | Program and library code | $0764 - $0771
text   | Program and library code | $0772 - $07B0
float_te | Arithmetic routine code| $07B1 - $07FF
rbss_0   | Bank 0 RAM variables   | $0020 - $0028
temp   | Temporary RAM data       | $0070 - $0076
Memory Usage Map:
Program ROM   $0000 - $0006$0007 (   7) words
Program ROM   $0764 - $07FF$009C (   156) words
                           $00A3 (   163) words total Program ROM
Bank 0 RAM    $0020 - $0028$0009 (   9) bytes
Bank 0 RAM    $0070 - $0076$0007 (   7) bytes
                           $0010 (    16) bytes total Bank 0 RAM

Program statistics:
Total ROM used      163 words (4.0%)
Total RAM used       16 bytes (9.1%)

BUILD FAILED: Mon Feb 09 17:37:11 2004

winnie 发表于 2009-3-24 13:47:27

ustep(unsigned int x,unsigned y)       //没有定义返回类型
{ unsigned int n;
n=834/abs(x-y);
if(n==0)
   n=1;
   else if(n>255)
   n=255;
return(n);
}

改:

uchar ustep(unsigned int x,unsigned int y)
{ unsigned int n;
n=834/abs(x-y);
if(n==0)                     
   n=1;
   else if(n>255)
   n=255;
return (uchar)(n);
}
页: [1]
查看完整版本: 我在MPLAB IDE6.4编译如下程序,老有BUILD FAILED!,不知为何?