forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compiling Problems with sprintf? (PRX module)

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
jtwald



Joined: 04 Jan 2006
Posts: 24

PostPosted: Thu Sep 21, 2006 2:08 am    Post subject: Compiling Problems with sprintf? (PRX module) Reply with quote

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
View user's profile Send private message AIM Address
adrahil



Joined: 16 Mar 2006
Posts: 277

PostPosted: Thu Sep 21, 2006 4:57 am    Post subject: Reply with quote

did you link it to libc? (-lc)
show us your makefile...
Back to top
View user's profile Send private message
jtwald



Joined: 04 Jan 2006
Posts: 24

PostPosted: Thu Sep 21, 2006 10:53 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
mbf



Joined: 18 Aug 2006
Posts: 55

PostPosted: Thu Sep 21, 2006 10:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
jtwald



Joined: 04 Jan 2006
Posts: 24

PostPosted: Thu Sep 21, 2006 10:47 pm    Post subject: Reply with quote

Would compiling it with xprintf.c from newlib work?
_________________
http://www.omlette.net/uniterror/
Back to top
View user's profile Send private message AIM Address
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Fri Sep 22, 2006 1:46 am    Post subject: Reply with quote

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
View user's profile Send private message
jtwald



Joined: 04 Jan 2006
Posts: 24

PostPosted: Fri Sep 22, 2006 7:34 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
jtwald



Joined: 04 Jan 2006
Posts: 24

PostPosted: Fri Sep 22, 2006 12:55 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Fri Sep 22, 2006 3:27 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group