1. mkdir include: 创建一个名为 'include' 的文件夹。

  2. mv print.h include/: 将 'print.h' 文件移动到 'include' 文件夹中。

  3. gcc -o hello2 -Iinclude hello.c print.c: 使用 gcc 编译器编译 'hello.c' 和 'print.c' 两个源代码文件,并将生成的可执行文件命名为 'hello2'。其中,'-Iinclude' 选项告诉编译器在 'include' 文件夹中查找头文件。

C 语言编译:使用 mkdir、mv 和 gcc 构建项目

原文地址: https://www.cveoy.top/t/topic/gO2j 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录