| View previous topic :: View next topic |
| Author |
Message |
jtwald
Joined: 04 Jan 2006 Posts: 24
|
Posted: Thu Sep 21, 2006 2:08 am Post subject: Compiling Problems with sprintf? (PRX module) |
|
|
when I comment out the lines in my PRX which I use sprintf - I don't receive this error.:
after it compiles, i nthe object linking stage:
| Code: | main.o In function 'displayCoordinates':
main.c:(.text+7c): undefined reference to '__extendsfdf2' |
but i need to be able to use sprintf :/
I'm not sure what is wrong or have any idea what that error means. _________________ http://www.omlette.net/uniterror/ |
|
| Back to top |
|
 |
adrahil
Joined: 16 Mar 2006 Posts: 277
|
Posted: Thu Sep 21, 2006 4:57 am Post subject: |
|
|
did you link it to libc? (-lc)
show us your makefile... |
|
| Back to top |
|
 |
jtwald
Joined: 04 Jan 2006 Posts: 24
|
Posted: Thu Sep 21, 2006 10:53 am Post subject: |
|
|
| adrahil wrote: | did you link it to libc? (-lc)
show us your makefile... |
I'm sorry, I should have posted it before:
| Code: |
TARGET = PRXTest
OBJS = font.o main.o
BUILD_PRX=1
USE_KERNEL_LIBC=1
USE_KERNEL_LIBS=1
PRX_EXPORTS=exports.exp
INCDIR =
CFLAGS = -Os -G0 -Wall -fno-strict-aliasing -fno-builtin-printf
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LDFLAGS = -nostdlib -nodefaultlibs
LIBS = -ldevhook -lpsppower
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak |
_________________ http://www.omlette.net/uniterror/ |
|
| Back to top |
|
 |
mbf
Joined: 18 Aug 2006 Posts: 55
|
Posted: Thu Sep 21, 2006 10:02 pm Post subject: |
|
|
You are using the kernel libc and sprintf is not included in it. You'll have to make your own sprintf.
Tip: grab the sources of newlib.... |
|
| Back to top |
|
 |
jtwald
Joined: 04 Jan 2006 Posts: 24
|
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Fri Sep 22, 2006 1:46 am Post subject: |
|
|
| sprintf does exist in the kernel libc, what the real problem is you are converting floating point values around which isn't getting linked in (that function is part of libgcc it extends 32bit floats to doubles). However the kernel libc doesn't support float formatting anyway so I wouldn't bother continuing on that vein. |
|
| Back to top |
|
 |
jtwald
Joined: 04 Jan 2006 Posts: 24
|
Posted: Fri Sep 22, 2006 7:34 am Post subject: |
|
|
| TyRaNiD wrote: | | sprintf does exist in the kernel libc, what the real problem is you are converting floating point values around which isn't getting linked in (that function is part of libgcc it extends 32bit floats to doubles). However the kernel libc doesn't support float formatting anyway so I wouldn't bother continuing on that vein. |
So I need to use doubles? Or what is the fix for this... _________________ http://www.omlette.net/uniterror/ |
|
| Back to top |
|
 |
jtwald
Joined: 04 Jan 2006 Posts: 24
|
Posted: Fri Sep 22, 2006 12:55 pm Post subject: |
|
|
I'm sorry, I now undrstand what you meant.
Hmph, that leaves me with no way to do what I wanted and plenty of wasted time.
Gotta love psp development :) _________________ http://www.omlette.net/uniterror/ |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Fri Sep 22, 2006 3:27 pm Post subject: |
|
|
Well not exactly, you could as suggested try and copy xprintf.c from the pspsdk libc and try and link it directly into your application, alternatively you could do what I did in psplink and write a simple float->string function and then only use sprintf to fomat a string not a float, it is admittedly more hassle but it might be your only way.
Incidently the functions it is missing for float conversion should be getting linked in, are you linking your app with gcc or going to ld directly ? |
|
| Back to top |
|
 |
|