I am creating a main.c file to use functions from several different .h files. Some of these .h files (or rather, their .c source files) use the same thing (standard, but also some others)
My question is: is everything all right if I just include them once for all the header files in my main.c, or should I allow each .h file to include them separately and not to include in my main.c (given that I only use functions from these header files)?
Or should I do both?
How am I doing it now:
dist.c: #include "dist.h" #include <stdio.h> #include <unistd.h> #include "rpiGpio.h" #include <pthread.h> #include <wiringPi.h> #include <softPwm.h>
Then for another:
cmps.c: #include "cmps.h" #include <stdint.h> #include <stdio.h> #include <unistd.h> #include <math.h> #include "rpiGpio.h"
Then in my main.c:
#include <stdio.h> #include <stdlib.h> #include "dist.h" #include "cmps.h"
Thanks in advance!
source share