shell

1. 预处理阶段

由于在test.c中使用了头文件stdio.h,所以GCC在编译时首先要把头文件stdio.h中的内容加载到test.c中的首部。

在shell中输入命令“gcc -E test.c -o test.i”。其中,参数E告诉gcc命令只进行预编译,不做其他处理;参数o用来指明输出的文件名为test.i。命令运行完毕后就会产生一个名为test.i的文件。如下所示:

[root@localhost home]#gcc -E test.c -o test.i

[root@localhost home]#ls

test.c test.i

test.i文件的代码有一百多行,如下所示的是test.i文件的最后部分代码。

extern char *ctermid (char *__s) __attribute__ ((__nothrow__));

# 820 "/usr/include/stdio.h" 3 4

extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__));

 

 

 

extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__)) ;

 

 

extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__));

# 850 "/usr/include/stdio.h" 3 4

 

# 2 "test.c" 2

int main()

{

  printf(“Hello world!\n”);

  return 0;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值