可能重复:
未定义 pow()
void octal2decimal(char *octal, char *decimal) {
int oct = atoi(octal);
int dec = 0;
int p = 0;
while (oct!=0) {
dec = dec + (oct%10) * pow(8,p++); //since oct is base 8
oct/=10;
}
*decimal = (char)dec;
*/
}
对于上面的以下代码,我收到此错误,我不知道为什么要包含math.h
,但我仍然收到此错误
/tmp/cck07bLe.o: In function 'octal2decimal':
data-converter.c:(.text+0x35f): undefined reference to 'pow'
collect2: ld returned 1 exit status
这是什么意思?我该如何解决?