So, I get the point of headers and source files. What I am not getting is how the compiler knows to compile all the source files. Example:
example.h
#ifndef EXAMPLE_H
#define EXAMPLE_H
int example(int argument);
#endif
example.c
#include "example.h"
int example(int argument)
{
return argument + 1;
}
main.c
#include "example.h"
main()
{
int whatever;
whatever = example(whatever);
}
How does the compiler, when compiling main.c, know the implementation example()when it does not include anything example.c?
Is this some kind of thing in the IDE where you add files to projects and stuff? Is there a way to do this “manually” as I prefer a simple text editor for dodgy IDEs?
source
share