Project added code does not build - undefined reference to

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Project added code does not build - undefined reference to

跳至解决方案
1,239 次查看
Badman
Contributor I

I am using MCUXpresso IDE v11.5.1 [Build 7266] [2022-04-13].

I added icludes path to "${workspace_loc:/${ProjName}/hd44780}"

Include paths.png

I added source location to "WYS_HD44780\hd44780"

Source Location.png

However, when building, I have a message undefined reference to... What am I doing wrong ?

 

 

Building target: WYS_HD44780.axf
Invoking: MCU Linker
arm-none-eabi-gcc -nostdlib -L"/home/badman/Programowanie/LPC1114_MCU/CMSIS_CORE_LPC11xx/Debug" -Xlinker -Map="WYS_HD44780.map" -Xlinker --cref -Xlinker --gc-sections -Xlinker -print-memory-usage -mcpu=cortex-m0 -mthumb -T "WYS_HD44780_Debug.ld" -o "WYS_HD44780.axf"  ./src/WYS_HD44780.o ./src/cr_startup_lpc11xx.o ./src/crp.o ./src/delay.o   -lCMSIS_CORE_LPC11xx
/usr/local/mcuxpressoide-11.5.1_7266/ide/plugins/com.nxp.mcuxpresso.tools.linux_11.5.1.202201181444/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: ./src/WYS_HD44780.o: in function `main':
Memory region         Used Size  Region Size  %age Used
        MFlash32:         672 B        32 KB      2.05%
         RamLoc8:          0 GB         8 KB      0.00%
/home/badman/Programowanie/LPC1114_MCU/WYS_HD44780/Debug/../src/WYS_HD44780.c:20: undefined reference to `lcd_init'
/usr/local/mcuxpressoide-11.5.1_7266/ide/plugins/com.nxp.mcuxpresso.tools.linux_11.5.1.202201181444/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: /home/badman/Programowanie/LPC1114_MCU/WYS_HD44780/Debug/../src/WYS_HD44780.c:21: undefined reference to `lcd_str'
collect2: error: ld returned 1 exit status
make[1]: *** [makefile:47: WYS_HD44780.axf] Błąd 1
make: *** [makefile:38: all] Błąd 2
"make -r -j3 all" terminated with exit code 2. Build might be incomplete.

 

 

0 项奖励
回复
1 解答
1,230 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi 

Your first screenshot doesn't include "src" path. please add it.

Besides, I suggest you importing a lpcopen demo code, refer the demo code path settings to set your project path.

If the problem persists, please upload your project here, thus we can check it directly.

Thanks,

Jun Zhang

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,231 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi 

Your first screenshot doesn't include "src" path. please add it.

Besides, I suggest you importing a lpcopen demo code, refer the demo code path settings to set your project path.

If the problem persists, please upload your project here, thus we can check it directly.

Thanks,

Jun Zhang

0 项奖励
回复
1,221 次查看
Badman
Contributor I

I checked all the settings, it turned out that I deleted the file hd44780.c from the added folder hd44780.

The function prototypes were in the file hd44780.h and the functions were missing hence the undefined reference message.

 

0 项奖励
回复