Window下DOS之C语言
熟悉Dos命令
命令 | 简单介绍(如果感兴趣自己可以多了解了解去) |
---|---|
cd | 切换目录 |
dir | 查看目录信息 |
cls | 清屏 |
编译器
可以自行选择,比如vs 20xx(界面不算特比丑,如果电脑有点旧的话,带起来略有吃力),vc6.0(经典,就是各方面都有点老,主要是界面丑),qt等剩下的不多介绍。
本人用的是MinGW,安装好后在目录中找到gcc编译器,然后配置下环境变量,以便可以在dos命令中调用。
C语言简单入门
- gcc 待编译文件名 - o 编译后的文件名
- gcc编译过程
预处理:gcc -E hello.c -o hello.i (删除注释,将#include头文件导入,#define定义宏替换等)
编译: gcc -S hello.i -o hello.s( 生成汇编代码)
汇编: gcc -c hello.s - o hello.o (将汇编代码转换成机器可以执行的命令)
链接: gcc -E hello.o -o a(调用链接器来链接