Gcc编译流程和git记录

来源:互联网 发布:淘宝v任务平台下载 编辑:程序博客网 时间:2024/06/10 18:38

回顾以前的知识,并做简单的整理,出发!

平台:Linux 系统下

建立如下函数,并命名为hello.c

#include<stdio.h>

void main()

{

printf("Hello World!\n\r");

}

预编译(Pre-Processing) 

gcc-E hello.c-o hello.i

编译(Compiling) 

gcc-S hello.i-o hello.s

汇编(Assembling) 

gcc-c hello.s-o hello.o

链接(Linking) 

gcc hello.o-ohello

C源程序头文件-->预编译处理(c/cpp)-->编译程序本身-->优化程序-->汇编程序-->链接程序-->可执行文件

-I dir 在头文件的搜索路径列表中添加dir目录

-L dir 在库文件的搜索路径列表中

-werror 把所有的告警信息转化为错误信息,并在告警发生时终止编译过程


git提交文档(记录一下,不然不以后忘了)


git status //状态查看

git add GCC/Makefile//添加文本(makefile)

git status

git commit -s或者git commit -m "name" //提交文本

git push --all //--all第一次需要使用


git的小点:git commit -F ../commit_log.txt//增加提交说明文件

    git diff > ../otp.patch//这两个目录在提交文件的前一个目录