Omnimaga
Calculator Community => Casio Calculators => Topic started by: blue_bear_94 on March 04, 2013, 05:37:33 pm
-
When I try to use stdlib.h functions (regardless of whether I #include <stdlib.h> or not), I get linker errors like these:
bullets.o: In function '_freeList':
bullets.c:(.text+0x384): undefined reference to '_free'
bullets.o: In function '_createNode':
bullets.c:(.text+0x39c): undefined reference to '_malloc'
Same for math.h functions. I also have the fxcglib installed. Are these functions not implemented yet?
Thanks in advance!
-
How did you compiled your program? What's the gcc command line used to compile this?
-
Both malloc and free are implemented in <stdlib.h>, but try including the raw library in your build folder and using
#include "stdlib.h"
to see if that fixes the problem. Otherwise, you're not calling the linker properly.
-
How did you compiled your program? What's the gcc command line used to compile this?
> sh3eb-elf-gcc bullets.o posnmath.o starvak2.o xpo.o -mb -m4a-nofpu -mhitachi -nostdlib -TC:/Users/Kook/Desktop/TISTUFF/PrizmSDK-0.3/common/prizm.ld -Wl,-static -Wl,-gc-sections -LC:/Users/Kook/Desktop/TISTUFF/PrizmSDK-0.3/lib -lfxcg -lgcc -o C:/Users/Kook/Desktop/TISTUFF/PrizmSDK-0.3/projects/starvak2/starvak2.bin
For some reason it's ignoring the standard libs. However, I can't change this because the make.bat file calls make.exe in the /bin folder.
Both malloc and free are implemented in <stdlib.h>, but try including the raw library in your build folder and using #include "stdlib.h"
to see if that fixes the problem. Otherwise, you're not calling the linker properly.
Will try!
Edit: tried it, and got the same error.
-
Try -lc in the command line?
-
Well, I use the make.bat file, which calls make.exe, so using -lc here doesn't work.
-
Deleting the -nostdlib flag in /common/prizm_rules and calling make.bat again resulted in these errors:
...: In function 'stack_k':
(.text+0x50): undefined reference to '_stack'
...
_end_k; end
_main_k; __setup_argv_and_call_main
_atexit_k; _atexit
And it goes on and on.