gcc:编译四部曲 梦里梦外; 2022-09-30 06:20 130阅读 0赞 在使用gcc 对C语言程序进行编译时,可细分为四个阶段:预处理(Pre-processing)、编译(Compiling)、汇编(Assembling)、链接(Linking)。用test.c为例说明: 1)预处理:gcc -E test.c -o test.i 对预编译指令都做相应的处理 2)编译:gcc -S test.i -o test.s 编译成汇编指令代码 3)汇编:gcc -c test.s -o test.o 将汇编指令代码转化为目标文件 4)链接:gcc test.o -o test 将目标文件与库文件(静态库或动态库)链接得到可执行文件。 **PS:事无巨细,悉以记之,必能裨补缺漏,有所广益。**
还没有评论,来说两句吧...