Advertisement

include files

Started by July 20, 2002 03:13 AM
0 comments, last by Escaflowne75 22 years, 5 months ago
Hi all. I''m curious as too what might be the best way to include other files in your project. I was taught to use a .cpp file for each logical section of code. I''m reading through Zen of Direct3D game programing and the author is using a single .h file to include the whole of his engine. Does it matter? Is it more of a preference? I imagine as projects get larger, it would make the most sense to seperate the code. Let me know what you think. -Escaflowne75
It''s a matter of organization and re-useability. Placing all the "text print" code, for example, in one file makes it easier to include those functions in other projects simply by including the .c/pp and .h files. It also stands to reason that if you want to look for a function that prints a char on the screen, you''d start looking in the "text print" file.

However, sometimes it''s better to place all the .h files in one single file, and include that in all the .c/pp files. That way when anything new is added or a function changes its inputs/outputs etc, you can be sure that all the files in your project get re-compiled. There are some compilers that get confused with multiple .h files.

Roo, Pantheon Software

This topic is closed to new replies.

Advertisement