14104 views|12 replies

34

Posts

0

Resources
The OP
 

MPLAB X IDE Learning Compilation Failed for PIC XC8 Compiler [Copy link]

 
I saw MPLAB X IDE programming examples for PIC XC8 compiler on the Internet https://simple-circuit.com/pic-microcontroller-mplab-xc8-lcd/ Google Translate September 30, 2018 Simple Project LCD and PIC Microcontroller Interface | MPLAB Project This article shows how to interface a PIC16F887 microcontroller with a 16×2 LCD screen (with HD44780 controller). The compiler used in this example is Microchip MPLAB XC8 (MPLAB X IDE with MPLAB XC8 compiler). I downloaded the program 387078 LCD_Lib.c main.c but the compilation failed. Please help.

program.rar

2.32 KB, downloads: 45

This post is from Microchip MCU

Latest reply

I also encountered this problem in 2023. Do you know what the reason is? Is there any solution?   Details Published on 2023-8-17 14:17
 

1972

Posts

0

Resources
2
 
Rebuild a project and recompile. Some of the old code may not be applicable to the XC8 compiler. You need to check the error information to eliminate them one by one.
This post is from Microchip MCU
 
 
 

1w

Posts

25

Resources
3
 
At least post the error message so that everyone can analyze it.
This post is from Microchip MCU
 
 
 

419

Posts

1

Resources
4
 
It should be that the xc8 version you use is newer, and the version he uses is a little older. There is an incompatibility somewhere. Take a screenshot and see the error message
This post is from Microchip MCU
 
 
 

34

Posts

0

Resources
5
 
非常感谢指导  
  MPLAB X IDE 5.05  XC8 2.0  新安装的    程序例子  也是 MPLAB X IDE 5.05  XC8 2.0  编写
编译失败
  LCD_Lib.c:46:3: error: use of undeclared identifier 'LCD_D4'      LCD_D4 = n & 0x01;
  LCD_Lib.c:47:3: error: use of undeclared identifier 'LCD_D5'      LCD_D5 = (n >> 1) & 0x01;
  ...  ...
LCD_Lib.c:120:3: error: use of undeclared identifier 'LCD_D6_DIR'     LCD_D6_DIR = 0;

fatal error: too many errors emitted, stopping now [-ferror-limit=]

make[2]: *** [build/default/production/main.p1] Error 1
make[2]: *** Waiting for unfinished jobs....
nbproject/Makefile-default.mk:114: recipe for target 'build/default/production/main.p1' failed
make[2]: *** [build/default/production/LCD_Lib.p1] Error 1
make[1]: *** [.build-conf] Error 2
(908) exit status = 1
make: *** [.build-impl] Error 2
nbproject/Makefile-default.mk:122: recipe for target 'build/default/production/LCD_Lib.p1' failed
make[2]: Leaving directory 'C:/Users/higer/Desktop/PIC16F887LCD1602/pic01.X'
nbproject/Makefile-default.mk:90: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/Users/higer/Desktop/PIC16F887LCD1602/pic01.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed

请教一位老师  说应该在 头文件中加一个包含PIC16F887的语句   已加入  出现上述错误
  
This post is from Microchip MCU
 
 
 

419

Posts

1

Resources
6
 
wang5825 posted on 2018-11-14 11:36 Thank you very much for your guidance MPLAB X IDE 5.05 XC8 2.0 The newly installed program example is also MPLAB X IDE 5.05 XC8 2.0 ...
The port definition is missing, which is the wires connected to the LCD
This post is from Microchip MCU
 
 
 

419

Posts

1

Resources
7
 
Lack of macro definition for LCD hardware port
This post is from Microchip MCU
 
 
 

34

Posts

0

Resources
8
 
Thank you very much for the guidance. Main.c #define LCD_RS RD0 #define LCD_EN RD1 #define LCD_D4 RD2 #define LCD_D5 RD3 #define LCD_D6 RD4 #define LCD_D7 RD5 #define LCD_RS_DIR TRISD0 #define LCD_EN_DIR TRISD1 #define LCD_D4_DIR TRISD2 #define LCD_D5_DIR TRISD3 #define LCD_D6_DIR TRISD4 #define LCD_D7_DIR TRISD5 #include     Add #include
I'm confused, please give me some guidance
   
This post is from Microchip MCU
 
 
 

34

Posts

0

Resources
9
 
New project
编译
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/Users/higer/Desktop/PIC16F887LCD1602/pic01.X'
make  -f nbproject/Makefile-default.mk dist/default/production/pic01.X.production.hex
make[2]: Entering directory 'C:/Users/higer/Desktop/PIC16F887LCD1602/pic01.X'
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8-cc.exe"  -mcpu=16F887 -c  -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -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/main.p1 main.c
not well-formed (invalid token) at line 1
XCLM: bad xml format in xclm.conf
not well-formed (invalid token) at line 1
XCLM: bad xml format in xclm.conf
::: 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
"C:\Program Files (x86)\Microchip\xc8\v2.00\bin\xc8-cc.exe"  -mcpu=16F887 -Wl,-Map=dist/default/production/pic01.X.production.map  -DXPRJ_default=default  -Wl,--defsym=__MPLAB_BUILD=1  -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -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      -Wl,--memorysummary,dist/default/production/memoryfile.xml -o dist/default/production/pic01.X.production.elf  build/default/production/main.p1     
not well-formed (invalid token) at line 1
XCLM: bad xml format in xclm.conf
not well-formed (invalid token) at line 1
XCLM: bad xml format in xclm.conf
::: 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
not well-formed (invalid token) at line 1
XCLM: bad xml format in xclm.conf
not well-formed (invalid token) at line 1
XCLM: bad xml format in xclm.conf
Memory Summary:
    Program space        used     7h (     7) of  2000h words   (  0.1%)
    Data space           used     2h (     2) of   170h bytes   (  0.5%)
    EEPROM space         used     0h (     0) of   100h bytes   (  0.0%)
    Data stack space     used     0h (     0) of    60h bytes   (  0.0%)
    Configuration bits   used     0h (     0) of     2h words   (  0.0%)
    ID Location space    used     0h (     0) of     4h bytes   (  0.0%)
make[2]: Leaving directory 'C:/Users/higer/Desktop/PIC16F887LCD1602/pic01.X'
make[1]: Leaving directory 'C:/Users/higer/Desktop/PIC16F887LCD1602/pic01.X'
编译已成功 (总时间: 1s)
正在加载代码C:/Users/higer/Desktop/PIC16F887LCD1602/pic01.X/dist/default/production/pic01.X.production.hex...
加载完成

2018-11-14_120020.jpg (24.39 KB, downloads: 2)

2018-11-14_120020.jpg
This post is from Microchip MCU
 
 
 

419

Posts

1

Resources
10
 
The message has been sent, you can check it out
This post is from Microchip MCU
 
 
 

2

Posts

0

Resources
11
 
dcexpert posted on 2018-11-13 20:48 At least post the error message so that everyone can analyze it

This post is from Microchip MCU
 
 
 

2

Posts

0

Resources
12
 

The header file is not missing, but the compilation fails. What is the problem?

This post is from Microchip MCU
 
 
 

4

Posts

0

Resources
13
 

I also encountered this problem in 2023. Do you know what the reason is? Is there any solution?

This post is from Microchip MCU
 
 
 

Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list