Undefined reference to 'sqrt' from math.h on PS3 with YDL 6.1 and Cell SDK 3.1?

I have a PS3 on which I installed YDL 6.1 and SDK 3.1, and everything seems to work fine, as I can compile and run the examples. However, I had problems writing my own programs. I created a small test case that seems to indicate the reason for the failure. I have the following code:

// mathtest.c
#include <stdio.h>
#include <math.h>

int main ()
{
  double param, result;
  param = 1024.0;
  result = sqrt (param);
  printf ("sqrt(%lf) = %lf\n", param, result );
  return 0;
}

When i started

ppu-gcc mathtest.c

I get the following error

/tmp/ccFqwJdG.o:(.text+0x20): undefined reference to `sqrt'
collect2: ld returned 1 exit status

I already checked to make sure math.h exists on this system and it defines sqrt. I also already tried to run this:

ppu-gcc -I/usr/includes/ mathtest.c

but this leads to the same error. I'm confused, who has any ideas?

+3
source share
1

Linux, -lm gcc. , . .

+4

Source: https://habr.com/ru/post/1704231/


All Articles