This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
                                
                                    (32个答案)
                                
                        
                                3年前关闭。
            
                    
尝试编译此代码时出现Undefined reference错误。

#include <stdio.h>

int power(int m, int n);

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

最佳答案

您声明了power,但需要实现它。

#include <stdio.h>

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

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

关于c - 未定义电源引用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40635513/

10-17 01:51