也许不是一个非常重要的问题,但只是开始在c。 这为什么不能正确编译?问题itoa转换整数到字符串
#include <stdio.h>
#include <stdlib.h>
void main()
{
int i = 15;
char word[100];
itoa (i,word,10);
printf("After conversion, int i = %d, char word = %s", i, word);
}
我不断收到错误消息
Undefined symbols:
"_itoa", referenced from:
_main in ccubsVbJ.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
这是一个非标准函数,可能不包含在您的stdlib.h中。见维基百科,http://en.wikipedia.org/wiki/Itoa – thelaws 2011-04-07 01:57:00
定义你的main为'int main()'。更多在这里:http://stackoverflow.com/questions/636829/difference-between-void-main-and-int-main – Muggen 2011-04-07 01:58:12
所有问题都很重要 - 对于某人:-) – 2011-04-07 02:13:43