C语言代码
#include <stdio.h> int main() { printf("hello, world "); return 0; }
GCC编译
gcc -o hello hello.c
会得到一个hello的可执行二进制文件
执行
./hello
打印出hello, world
C语言代码到可执行文件的过程
核心:预处理、编译、汇编、链接
预处理主要是把include中的头文件插入源代码中,形成一个新的源代码hello.i
#include <stdio.h> int main() { printf("hello, world "); return 0; }
gcc -o hello hello.c
会得到一个hello的可执行二进制文件
./hello
打印出hello, world
核心:预处理、编译、汇编、链接
预处理主要是把include中的头文件插入源代码中,形成一个新的源代码hello.i