19
loading...
This website collects cookies to deliver better user experience
preprocessing
compiling
assembling
linking
/*here we only declare name, type and parameters of our function,
we don't say what the function does (aka we don't specify the
function body), that's why it's a prototype.*/
int area( int length, int breadth );
#include<stdio.h>
), header files are files that contain prototypes for all the functions from the libraries we include in our code.#include <stdio.h>
int main(void)
{
printf("hello, world\n");
}
//prototypes from printf function
...
int printf(string format, ...);
...
int main(void)
{
printf("hello, world\n");
}
Object code is a portion of machine code not yet linked into a
complete program. It's the machine code for one particular library
or module that will make up the completed product. It may also
contain placeholders or offsets not found in the machine code of a
completed program. The linker will use these placeholders and
offsets to connect everything together.
-l
, and we use it without the lib prefix to link with the library file. Ex: -lExampleLibrary
. If your library file is not where -l
looks by default you have to specify where is it using -L
. if the library code is inside the current folder you are:
gcc test.c -L. -lExampleLibrary -o test