mercredi 24 mars 2021

Bad practice for global #include in project?

I am currently constructing the framework for my first large scale C++ project. I have a fairly good grasp of academic scripting, but, as you know, making and maintaining a large project is another skill entirely.

One of the things I was wondering was if it was good practice to have a globally included header file. What I mean is to have a file #included in every single file. I know that MSVC supports some type of #pragma extension for this. The file would mainly be for macros. Example: some file in a src/config folder such as:

#ifndef PROJECT_HEADER_H_
#define PROJECT_HEADER_H_

// The ... would be actual code
#define ...
#define ...
#define ...

#endif

Thank you.

Aucun commentaire:

Enregistrer un commentaire