you dont need alot of headers, for each .c file you can create a .h file. in the .h file you have all the declarations of the functions with some #define's or other const values which you will use in your .c file.
#include all the necessary headers in .h file and include the .h file in the .c/.cpp file. that would be fine.
otherwise to include put all the necessary headers in a common location you can include all headers in a common header file and include that common header in all the .c/.cpp files. but this is not the correct practice though.
actually there is not exact rules how you should make your .h files, it depends on the scenario's.
Thank writetonsharma, firedraco for answer to my question.
I commonly made like yours.
but, When I worked with teams, sources are bigger than with few programmers.
When I make some .h files and used theirs or standard .h, I'm confused how I divide or include that.
For example, a sampleA.c file use a, b, c, .... u.h and the b sample file use
f, g, h... z.h and so on...
We had many .h files.
And we used the common_header.h included a,b,c....z.h.
If I have to make some .c files(divide sources for maintenance or etc),
I was confused. because the common_header is not good I think.
If one header file has all headers by #define, useless header files were
included. I think it's not clear sources, so I ask you for solving this problems.
Does the one header have all headers is no problems ??
It's only depended on my owns or my team strategy?
Else almost programmer do like this?? (for easily maintenance)
Do I think useless things?
I really want to know the good plan to divide or include files.
Thank you for read my asking.
Anybody reply for me ~ Plz~~
If you have a single header that includes all the others, it isn't incredibly bad...I wouldn't do it, since it would waste time making sure the header files aren't already included, but it probably isn't enough to worry about.
including headers is not a very big issue, you can add your .h files in .cpp files to any extent. if you have many include all of them in .cpp..there isnothing to worry. even if you include them multiple times the
#ifndef
block at the top of header will not include them more than once. which firedraco has shown..