Questions tagged [include]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
49
votes
7answers
23k views

How can I prevent header hell?

We are starting a new project, from scratch. About eight developers, a dozen or so subsystems, each with four or five source files. What can we do to prevent “header hell”, AKA “spaghetti headers”? ...
10
votes
7answers
4k views

Ensuring that headers are explicitly included in CPP file

I think it's generally good practice to #include the header for any types used in a CPP file, regardless of what is already included via the HPP file. So I might #include <string> in both my HPP ...
7
votes
1answer
4k views

When defining directory path, should a trailing slash be included?

Say I'm defining a directory and then including files from it. Is it better practice to do: define('PATH', 'C:/xampp/htdocs/includes/'); require PATH.'header.php; or: define('PATH', 'C:/xampp/...
4
votes
2answers
5k views

Is including headers inside a namespace always a bad idea?

The replies in this post come very strongly against including headers inside a namespace and Doxygen is confused if that is done (which suggests that its team did not consider that usage either). I ...
3
votes
2answers
1k views

Include own header file first or last? Any technical reasons?

I was revisiting my question How can I prevent header hell?, when I noticed a comment which said A good technique for ensuring a header is independent is having a rule that the source file always ...