本帖最后由 pzsh 于 2022-8-15 16:58 编辑
第一次安装使用,就写了个最简单的程序一直编译出错,网上找了很多资料都无法解决,求大神解决;附代码: 附件有整个工程文件
#pragma config FOSC = INTRCIO // Oscillator Selection bits (INTOSC oscillator: I/O function on GP4/OSC2/CLKOUT pin, I/O function on GP5/OSC1/CLKIN)
#pragma config WDTE = ON // Watchdog Timer Enable bit (WDT enabled)
#pragma config PWRTE = OFF // Power-Up Timer Enable bit (PWRT disabled)
#pragma config MCLRE = OFF // GP3/MCLR pin function select (GP3/MCLR pin function is digital I/O, MCLR internally tied to VDD)
#pragma config BOREN = ON // Brown-out Detect Enable bit (BOD enabled)
#pragma config CP = OFF // Code Protection bit (Program Memory code protection is disabled)
#pragma config CPD = OFF // Data Code Protection bit (Data memory code protection is disabled)
// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.
#include <xc.h>
#define uchar unsigned int
#define LED1 GP0
#define LED2 GP1
void delay(uchar z);
void main(void)
{
while(1)
{
LED1=0;
LED2=1;
delay(500);
LED1=1;
LED2=0;
delay(500);
}
}
void delay(uchar z)
{
uchar x,y;
for(x=0;x<200;x++)
for(y=0;y<z;y++);
}
编译结果:
清除已成功 (总时间: 9ms)
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/Users/���乤�̵���/MPLABXProjects/TEST.X'
make -f nbproject/Makefile-default.mk dist/default/production/TEST.X.production.hex
make[2]: Entering directory 'C:/Users/���乤�̵���/MPLABXProjects/TEST.X'
"D:\Microchip\xc8\v2.31\bin\xc8-cc.exe" -mcpu=12F675 -c -mdfp="D:/MPLABX/v5.45/packs/Microchip/PIC10-12Fxxx_DFP/1.3.46/xc8" -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -I"USER" -mwarn=-3 -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o build/default/production/USER/main.p1 USER/main.c
::: advisory: (2049) C99 compliant libraries are currently not available for baseline or mid-range devices, or for enhanced mid-range devices using a reentrant stack; using C90 libraries
make[2]: *** [build/default/production/USER/main.p1] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
terminate called after throwing an instance of 'std::invalid_argument'
what(): No such file or directory
error: clang frontend command failed with exit code 3 (use -v to see invocation)
(908) exit status = 1
nbproject/Makefile-default.mk:107: recipe for target 'build/default/production/USER/main.p1' failed
make[2]: Leaving directory 'C:/Users/���乤�̵���/MPLABXProjects/TEST.X'
nbproject/Makefile-default.mk:91: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/Users/���乤�̵���/MPLABXProjects/TEST.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
编译已失败 (退出值2, 总时间: 2s) |