I'm going rounds with the compiler right now, and I want to make sure the problem isn't a fundamental misunderstanding of how header files. If I include a header file, and that header file has includes in it (like <stdbool.h>
or <stdio.h>
, etc...), there shouldn't be any issue on the dependent C file, right? The preprocessor should just insert the assembled code accordingly when I call my makefile, by my understanding. Am I mistaken?
To reiterate:
Say I have a
main.c
withprototype.h
.prototype.h
has in it all of my usual includes for libraries and what-not.I have a couple other C files (
secondary.c
andtertiary.c
, for instance), both of which need the usual libraries, as well, and may or may not need some of the prototypes and also have their own header files.
All I'd need to do is include prototype.h
in each of the C files, correct?
Also, in that instance, if I were making .o
file using the -c
flag of gcc
in my makefile
, would I need to update the dependency in the target of the makefile
?
I thought I had a solid handle on this when I started, but now I'm thoroughly confused.