Es handelt sich um ff. C-Code:
Code:
int find_prime( end_of_loop )
int end_of_loop;
{
int is_prime = 1;
int loop_end = (int)sqrt((double)end_of_loop );
int result = -1;
int i = -1;
for ( i = 2; i <= loop_end; i++ )
{
result = end_of_loop % i;
if ( result == 0 )
{
is_prime = 0;
break;
}
}
return is_prime;
}
und folgender Fehlermeldung:
Code:
/tmp/cccTcVmx.o(.text+0xfe): In function `find_prime':
/home/xxx/prime.c:45: undefined reference to `sqrt'
collect2: ld returned 1 exit status
Gut, anfangs wuerdet ihr sagen, bindet die math.h ein, das hab ich aber schon laengst gemacht, geht trotzdem nicht .
Insgesamt hab ich
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <sys/errno.h>
eingebunden. Befehle wie floor kann ich ausfuehren, das Problem liegt anscheinden nur bei sqrt...
mfg nul
Lesezeichen