Adding New Files


When adding new files to a project, you will need to have a header file for declarations and a CPP file for definitions. File names should be all lowercase and include underscores for spaces. The name of each file should represent its significance; this goes for both header files and CPP files. Also, all header files should go within the respective “Header Filesfilter in each project, just as all CPP files should go within the “Source Filesfilter in each project. Of course, each file may be more appropriately place within a deeper level of filters beyond those two. Also, you only need to add a file to a project if you are going to use it in that project.



When using a file across multiple projects, you should check to see if it is included in the project build after adding it to the necessary filters in each project. You can do this by finding the file, then Right_Click>Include_In_Project. If you see “Exclude From Project”, then that file has already been included in the build for that project. Additionally, you should also ensure that these files are being tracked by GitHub, although this should automatically happen.

We follow a formatting convention when it comes using header files in Ironfist. At the beginning of every header file, we start with an Include Guard Macro that prevents includes from doubling up during compilation. The formatting for this Macro should be all CAPS, with an underscore to denote a period/dot and the Macro should end with the following “
H”. For example, “spell_constants.h” will have this as the very first line:

  #ifndef SPELL_CONSTANTS_H

Alternatively, you can simply use “
#pragma once” at the beginning of every header file instead of the Include Guard Macros. More info on this directive can be found here.

Also, after the
#include statements, if any, there should be a pragma pack() directive that tells the compiler not to include memory padding when laying out the structures in the memory. This means that there will be continuous use of memory; no spaces. This directive should wrap the contents of the file as well, but within the bounds of the Include Guard Macro. The format for this goes as follows:

  <Include Guard Macro OR #pragma once>
  <Include Statements>
  #pragma pack(push, 1)
  <Header File Body>
  #pragma pack(pop)
  <#endif OR nothing, if using #pragma once>

The formatting convention for CPP files should be the standard formatting convention for C++ files.