#119365 - Phantaseur - Thu Feb 22, 2007 1:16 pm
I have a problem creating simple hello world application. As I understand at first I need compile source and get object-file then link it and get elf-file, and then using objcopy get bin and nds files... What for such difficulties? Why can't I get nds-file after linking?
I have no problems with compilation
arm-eabi-g++ -mcpu=arm9tdmi -Wall -DARM9 -I/e/devkitPro/libnds/include/ -c helloworld.cpp
after this helloworld.o appears and I try to link it
/e/devkitPro/devkitarm/bin/arm-eabi-g++ -L/e/devkitPro/libnds/lib/ -lnds9 my.o -o helloworld.elf
but next output appears
helloworld.o: In function `main':
helloworld.cpp:(.text+0x7c): undefined reference to `vramSetBankC'
helloworld.cpp:(.text+0xa4): undefined reference to `consoleInitDefault'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-abort.o): In function `abort':
(.text+0xc): undefined reference to `_exit'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-exit.o): In function `exit':
(.text+0x28): undefined reference to `_exit'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
(.text+0x1c): undefined reference to `_sbrk'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-signalr.o): In function `_getpid_r':
(.text+0x8): undefined reference to `_getpid'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-signalr.o): In function `_kill_r':
(.text+0x38): undefined reference to `_kill'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-makebuf.o): In function `__smakebuf':
(.text+0xf4): undefined reference to `isatty'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-writer.o): In function `_write_r':
(.text+0x24): undefined reference to `_write'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-closer.o): In function `_close_r':
(.text+0x1c): undefined reference to `_close'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-fstatr.o): In function `_fstat_r':
(.text+0x20): undefined reference to `_fstat'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-lseekr.o): In function `_lseek_r':
(.text+0x24): undefined reference to `_lseek'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-readr.o): In function `_read_r':
(.text+0x24): undefined reference to `_read'
collect2: ld returned 1 exit status
make: *** [helloworld.elf] Error 1
As I know first two strings
helloworld.cpp:(.text+0x7c): undefined reference to `vramSetBankC'
helloworld.cpp:(.text+0xa4): undefined reference to `consoleInitDefault'
mean that there is no such functions in libnds, what else library need I load for these functions? And what mean other errors? What options need I use for successfull generating of nds-file?
Example of sourcecode of helloworld application I took here:
http://www.double.co.nz/nintendo_ds/nds_develop1.html
I have no problems with compilation
arm-eabi-g++ -mcpu=arm9tdmi -Wall -DARM9 -I/e/devkitPro/libnds/include/ -c helloworld.cpp
after this helloworld.o appears and I try to link it
/e/devkitPro/devkitarm/bin/arm-eabi-g++ -L/e/devkitPro/libnds/lib/ -lnds9 my.o -o helloworld.elf
but next output appears
helloworld.o: In function `main':
helloworld.cpp:(.text+0x7c): undefined reference to `vramSetBankC'
helloworld.cpp:(.text+0xa4): undefined reference to `consoleInitDefault'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-abort.o): In function `abort':
(.text+0xc): undefined reference to `_exit'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-exit.o): In function `exit':
(.text+0x28): undefined reference to `_exit'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
(.text+0x1c): undefined reference to `_sbrk'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-signalr.o): In function `_getpid_r':
(.text+0x8): undefined reference to `_getpid'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-signalr.o): In function `_kill_r':
(.text+0x38): undefined reference to `_kill'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-makebuf.o): In function `__smakebuf':
(.text+0xf4): undefined reference to `isatty'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-writer.o): In function `_write_r':
(.text+0x24): undefined reference to `_write'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-closer.o): In function `_close_r':
(.text+0x1c): undefined reference to `_close'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-fstatr.o): In function `_fstat_r':
(.text+0x20): undefined reference to `_fstat'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-lseekr.o): In function `_lseek_r':
(.text+0x24): undefined reference to `_lseek'
e:/devkitpro/devkitarm/bin/../lib/gcc/arm-eabi/4.1.1/../../../../arm-eabi/lib\libc.a(lib_a-readr.o): In function `_read_r':
(.text+0x24): undefined reference to `_read'
collect2: ld returned 1 exit status
make: *** [helloworld.elf] Error 1
As I know first two strings
helloworld.cpp:(.text+0x7c): undefined reference to `vramSetBankC'
helloworld.cpp:(.text+0xa4): undefined reference to `consoleInitDefault'
mean that there is no such functions in libnds, what else library need I load for these functions? And what mean other errors? What options need I use for successfull generating of nds-file?
Example of sourcecode of helloworld application I took here:
http://www.double.co.nz/nintendo_ds/nds_develop1.html