当我使用以下代码时,我的代码无法正确编译:
system("gcc -o filename temp.c");
我收到了以下错误信息:
implicit declaration of function system
我不确定缺少什么,因为只有在调用gcc时才会抛出该系统错误。
这是我的代码:
#include <stdio.h>
int main() {
...
system("gcc -o filename temp.c");
return 0;
}
#include <stdio.h>
后添加#include <stdlib.h>
,这里是system
函数的原型定义位置 - 参考链接:http://pubs.opengroup.org/onlinepubs/009695399/functions/system.html。 - Sean Bright