2016-11-16 30 views
-1

尝试编译此代码时出现Undefined reference错误。未定义的电源参考

#include <stdio.h> 

int power(int m, int n); 

int main() 
{ 
    printf("%d", power(2,5)); 
    return 0; 
} 
+0

尝试*链接*时出现此错误。它会编译好。 –

回答

2

宣布power但你需要实现它。

#include <stdio.h> 

int power(int m, int n) 
{ 
    .. your code goes here 
} 

int main() 
{ 
    printf("%d", power(2,5)); 
    return 0; 
}