Page 1 of 1

linker error: undefined reference to `__ctype_ptr__'

Posted: Sun Jun 24, 2018 2:18 pm
by zapp
I am trying to compile a little program I have written. I am using tonclib and the tonc text engine. However the linker throws the following errors:

Code: Select all

Linking cartridge
arm-none-eabi-gcc -specs=gba.specs -mthumb-interwork -mthumb -Wl,-Map, gfx_rain_2.o gfx_rain_3.o gfx_rain_4.o gfx_randy.o gfx_rain_1.o gfx_randy_shadow.o gfx_night.o gfx_world.o gfx_rabite.o engine_background_packer.o adt_double_linked_list.o engine_camera.o obj_randy.o engine_sprite.o engine_background.o main.o obj_randy_shadow.o obj_rabite.o   -L/home/pepe/Desktop/gba_dev/rpg_demo_test_compile -L/home/pepe/Desktop/gba_dev/rpg_demo_test_compile//tonclib/lib -ltonc -lm -o /home/pepe/Desktop/gba_dev/rpg_demo_test_compile/rpg_demo_test_compile.elf	
/home/pepe/Desktop/gba_dev/rpg_demo_test_compile//tonclib/lib/libtonc.a(tte_main.o): In function `tte_cmd_next':
tte_main.c:(.text+0x240): undefined reference to `__ctype_ptr__'
/home/pepe/Desktop/gba_dev/rpg_demo_test_compile//tonclib/lib/libtonc.a(tte_main.o): In function `tte_cmd_default':
tte_main.c:(.text+0x614): undefined reference to `__ctype_ptr__'
tte_main.c:(.text+0x7b4): undefined reference to `__ctype_ptr__'
collect2: error: ld returned 1 exit status
/home/pepe/Desktop/gba_dev/rpg_demo_test_compile//tonc_rules:41: recipe for target '/home/pepe/Desktop/gba_dev/rpg_demo_test_compile/rpg_demo_test_compile.elf' failed
make[1]: *** [/home/pepe/Desktop/gba_dev/rpg_demo_test_compile/rpg_demo_test_compile.elf] Error 1
Makefile:155: recipe for target 'build' failed
make: *** [build] Error 2
I already read this thread, and tried to add -lg to the linker flags, however this did not work.

The code with the Makefile did compile and link correctly in the past, but not anymore.

Can someone please help me?

Re: linker error: undefined reference to `__ctype_ptr__'

Posted: Mon Jun 25, 2018 3:26 pm
by WinterMute
libtonc needs rebuilt with latest toolchain.

I've added a libtonc package so you can install that with pacman -S libtonc then use -I$(DEVKITPRO)/libtonc/include for your includes & -L$(DEVKITPRO)/libtonc/lib for your libraries.

I'll have a look at adding templates & the tonc example code later, just need to check over some things with Cearn.

Re: linker error: undefined reference to `__ctype_ptr__'

Posted: Tue Jun 26, 2018 5:13 pm
by zapp
Wow, how embarrassing that I didn't think of this.

Thanks Dave, that solved my issue.