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 

Another issue with sinf cosf and sqrtf (External Lib)

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



Joined: 14 Jul 2005
Posts: 35
Location: Germany

PostPosted: Sat Aug 06, 2005 4:41 pm    Post subject: Another issue with sinf cosf and sqrtf (External Lib) Reply with quote

I'm working on a math library for the PSP in C.
Code:
float float2_length(float2* a) {
  return sqrtf(a->x * a->x + a->y * a->y);
}

And a lot of stuff like this. I compile this lib with psp-gcc and make an static library with psp-ar.
Then I add the lib path and the library to my psp-project Makefile, but when I compile this i get an linker error: undefined refernce to sqrtf.
I can use the sqrtf function in the psp-project without getting this error. So I tried to add the math library (-lm) and path to the library Makefile, but that didn't solve it. The confusing thing is, I can use some other functions in my library with out getting linker errors. I used the sceIo... functions and it work. Why not the math functions?
Yes i tried to search for this problem and found a lot of sqrtf problems, but using sqrtf in my main.c is not the problem. Install new toolchain and sdk didn't fix it too.
Back to top
View user's profile Send private message Visit poster's website
chp



Joined: 23 Jun 2004
Posts: 313

PostPosted: Sat Aug 06, 2005 5:35 pm    Post subject: Reply with quote

Make sure you place -lm AFTER your library in the library-order. When using GCC, link-order matters.
_________________
GE Dominator
Back to top
View user's profile Send private message
McZonk



Joined: 14 Jul 2005
Posts: 35
Location: Germany

PostPosted: Sat Aug 06, 2005 5:44 pm    Post subject: Reply with quote

Solved. thx chp!
Close.
Back to top
View user's profile Send private message Visit poster's website
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