Is it necessary to #include
some file, if inside a header (*.h), types defined in this file are used?
For instance, if I use GLib and wish to use the gchar
basic type in a structure defined in my header, is it necessary to do a #include <glib.h>
, knowing that I already have it in my *.c file?
If yes do I also have to put it between the #ifndef
and #define
or after the #define
?
Just include all external headers in one common header file in your project, e.g. global.h and include it in all your c files:
It can look like this:
This file uses include guard to avoid multiple inclusions, illegal multiple definitions, etc.