0
Good afternoon.
I have a problem with my C project. I have made some libraries and would like to centralize their imports in just one header so that when calling all, give a #include
only in the centering header and they are imported.
For example - I have three header’s: header1.h
,header2.h
and header3.h
and would like to centralize them into just one, central_header.h
. When to create the main.c
, instead of giving #include
in the three header’s I just run the #include central_header.h
that it already matters everyone to the main.c
.
Yes, these settings helped me a lot but I came to another difficulty. I made the includes in a centralized Header with #ifndef and another Header called this centralized Header and then the main one called it, but it didn’t work. Shouldn’t work?
– Felipe.ferreira
It should work, but if it’s not working it’s because there’s an error in at least 1 of the files. Check if the includes are really correct and if possible could you just send the includes part of all the header files so I can analyze the situation better? Note that the way I said only files . h work, files . c do not. To compile files . c you can include them in main. c or write it when compiling. Example in gcc: gcc -o main. c arquivo1.c arquivo2.c arquivon. c.
– Júlio Evêncio