.cpp file instead of the
This article on Header file include patterns should be helpful for you.
- Is there some preferred way to organize ones include directives?
Yes, you can find them in the above article.
- Is it better to include the files you need in the .cpp file instead of the .h file? Are the translation units affected somehow?
Yes, it is better to have them in .cpp. Even, if a defined type is required in definition of another type, you can use forward declaration.
- How about if I need it in both the .h file and .cpp file, should I just include it in the .h file? Will it matter?
Only in .h file, but it is suggested to forward declare in header files, and include in .cpp files.
- Is it a good practice to keep the already defined files in a precompiled header (stdafx.h), for instance std and third party libraries? How about my own files, should I include them in a stdafx.h file along the way as I create them?
I personally have not used precompiled headers, but there has been a discussion on them on Stackoverflow earlier:
Precompiled Headers? Do we really need them