当我用gcc编译器编译下面的代码时,它给了我错误:
/tmp/ccQ7MdHf.o:在函数
isPrime': source.c:(.text+0x66): undefined reference to
sqrt'cols2:错误:ld返回1退出状态
int isPrime(int n) //function to check passed number is prime or not
{
int i;
for(i=2;i<=sqrt(n);i++)
{
if(n%i == 0)
{
return 0; //if number is not prime return 0
}
}
return 1; //if number is prime return 1
}