Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
GCC编译源代码和库_C_Gcc_Compiler Construction - Fatal编程技术网

GCC编译源代码和库

GCC编译源代码和库,c,gcc,compiler-construction,C,Gcc,Compiler Construction,我有我的主C文件、另一个C文件(我正在使用它作为库)和两个头文件,其中包含每个C文件的函数原型 如何使用GCC将它们编译并链接到一个可执行文件中?我还想使用-o和-g标志 gcc -g -c first_file.c gcc -g -c second_file.c gcc -o executable first_file.o second_file.o 不过,一般来说,请先在谷歌上搜索gcc教程

我有我的主C文件、另一个C文件(我正在使用它作为库)和两个头文件,其中包含每个C文件的函数原型

如何使用GCC将它们编译并链接到一个可执行文件中?我还想使用
-o
-g
标志

gcc -g -c first_file.c
gcc -g -c second_file.c
gcc -o executable first_file.o second_file.o
不过,一般来说,请先在谷歌上搜索
gcc
教程