Project added code does not build - undefined reference to

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Project added code does not build - undefined reference to

Jump to solution
962 Views
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 Kudos
1 Solution
953 Views
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

View solution in original post

0 Kudos
2 Replies
954 Views
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 Kudos
944 Views
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 Kudos