2015-04-02 90 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