zwll 发表于 2022-8-4 21:06

MPLAB X IDE 使用XC8编译出错

本帖最后由 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: Entering directory 'C:/Users/���乤�̵���/MPLABXProjects/TEST.X'
make-f nbproject/Makefile-default.mk dist/default/production/TEST.X.production.hex
make: 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: *** Error 1
make: *** [.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: Leaving directory 'C:/Users/���乤�̵���/MPLABXProjects/TEST.X'
nbproject/Makefile-default.mk:91: recipe for target '.build-conf' failed
make: Leaving directory 'C:/Users/���乤�̵���/MPLABXProjects/TEST.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed

编译已失败 (退出值2, 总时间: 2s)

juventus9554 发表于 2022-8-4 21:13

会不会是缺少什么插件

chenho 发表于 2022-8-4 21:15

看不出来到底是什么问题

jlyuan 发表于 2022-8-4 21:17

看代码是没什么问题的啊

chuxh 发表于 2022-8-4 21:19

我这边没有安装最新版本

pengf 发表于 2022-8-4 21:21

我运行一下试试看 会不会出现这个问题哈

zwll 发表于 2022-8-4 21:23


唉,还是没有什么结果,算了,多谢大家啦

chenqianqian 发表于 2022-8-5 08:36

版本不兼容

lcczg 发表于 2022-8-5 13:42

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

13775172169 发表于 2022-8-23 14:18

我遇到类似的问题了 请问你解决了吗

13775172169 发表于 2022-8-23 14:19

13775172169 发表于 2022-8-23 14:18
我遇到类似的问题了 请问你解决了吗

你这个试试保存的地址写成全英文的
页: [1]
查看完整版本: MPLAB X IDE 使用XC8编译出错