为什么它显示错误像ld返回1退出状态和未定义的引用'powr(int,int)'为什么它显示错误像ld返回1退出状态和未定义的引用`powr(int,int)'
#include<stdio.h>
int powr (int m , int n);
int main(){
int i,m,n;
printf("print the base\n");
scanf("%d",&m);
printf("print the expoenent\n");
scanf("%d",&n);
int p ;
if (n == 1){
return m;
}
else {
p = powr(m,n/2);
if (n%2 ==0){
return p*p ;
}
else {
return p*p*m;
}
}
}
的可能的复制[C - 未定义参照SQRT(或其他数学函数)](http://stackoverflow.com/questions/5248919/c-undefined-reference-to-sqrt - 或者其他数学函数) –
C中没有标准函数'powr(int,int)'你是否指'math.h'中的'pow(double,double)'? – Bathsheba
你放了一个'powr'函数的原型,但是你没有提到它在问题中的定义。没有看到定义什么都不能说。 – haccks