2015-04-02 74 views
0

我正在为虚拟计算机编写一个c程序。我现在我遇到的问题是,当我尝试编译,我得到的,说:“未定义的引用‘POW’ 我不知道如何正确地改变它的错误。C编程:虚拟计算机

void memAssign(signed int *mem, char line[SIZE],signed int *memPos){ 
    signed int *count= &mem[73]; 
    signed int *length= &mem[74]; 
    *length = strlen(line)-1; 
    *count=1; 
    if(toDigit(line[*length-1])<0 || toDigit(line[*length-1])>9){ 
     printf("Wrong command form.\n"); 
     return; 
    } 
    while(line[*length - *count] != ' '){ 
     mem[*memPos] += (toDigit(line[*length - *count]) * (int)pow(10, *count - 1)); 
     *count += 1; 
    } 
    count = NULL; 
    length = NULL; 
} 
+2

你用'#包括'?[未定义参考 – 2015-04-02 04:56:16

+1

可能重复到\'战俘”和\'地板'](http://stackoverflow.com/questions/8 671366 /未定义引用到POW和地板) – 2015-04-02 04:58:16

回答

4

当使用你有math库函数包含头文件#include<math.h>。 然后在编译时你要链接。

cc filename.c -lm