小编use*_*493的帖子

非常简单的C程序无法在gcc编译器中编译

我有以下程序

main()
{
   char a,b;
   printf("will i get the job:");
   scanf("%c",&a);
   printf("%c",a);
   printf("We did it");
}
Run Code Online (Sandbox Code Playgroud)

我把文件保存为Hope.c.当我尝试使用gcc编译器编译上面的代码时,我将收到以下错误:

Hope.c:In function 'main':
Hope.c:4:2:warning:incompatible implicit declaration of built-in function 'printf' [enabled by default]          
Hope.c:5:2:warning:incompatible implicit declaration of built-in function scanf[enabled by default]
Run Code Online (Sandbox Code Playgroud)

当我使用printf()or时scanf(),编译器会出现此错误,即使在简单的"Hello world"程序中也是如此.

我的代码有问题,或者编译器有问题吗?

c compiler-construction gcc

1
推荐指数
1
解决办法
3473
查看次数

标签 统计

c ×1

compiler-construction ×1

gcc ×1