Another issue with sinf cosf and sqrtf (External Lib)

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
McZonk
Posts: 35
Joined: Thu Jul 14, 2005 10:42 pm
Location: Germany
Contact:

Another issue with sinf cosf and sqrtf (External Lib)

Post by McZonk »

I'm working on a math library for the PSP in C.

Code: Select all

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.
chp
Posts: 313
Joined: Wed Jun 23, 2004 7:16 am

Post by chp »

Make sure you place -lm AFTER your library in the library-order. When using GCC, link-order matters.
GE Dominator
McZonk
Posts: 35
Joined: Thu Jul 14, 2005 10:42 pm
Location: Germany
Contact:

Post by McZonk »

Solved. thx chp!
Close.
Post Reply