|
EnTT 3.13.1
|
Skip this part if you are working with UE5, Since UE5 uses cpp17 by default.
As of writing (Unreal Engine v4.25), the default C++ standard of Unreal Engine is C++14.
On the other hand, note that EnTT requires C++17 to compile. To enable it, in the main module of the project there should be a <Game Name>.Build.cs file, the constructor of which must contain the following lines:
Replace <PCH filename>.h with the name of the already existing PCH header file, if any.
In case the project doesn't already contain a file of this type, it's possible to create one with the following content:
Remember to remove any old PCHUsage = <...> line that was previously there. At this point, C++17 support should be in place.
Try to compile the project to ensure it works as expected before following further steps.
Note that updating a project to C++17 doesn't necessarily mean that the IDE in use will also start to recognize its syntax.
If the plan is to use C++17 in the project too, check the specific instructions for the IDE in use.
Once this point is reached, the Source directory should look like this:
To make this happen, create the folder ThirdParty under Source if it doesn't exist already. Then, add an EnTT folder under ThirdParty.
Within the latter, create a new file EnTT.Build.cs with the following content:
The last line indicates that the actual files will be found in the directory EnTT/entt/src/entt.
Download the repository for EnTT and place it next to EnTT.Build.cs or update the path above accordingly.
Finally, open the <Game Name>.Build.cs file and add EnTT as a dependency at the end of the list:
Note that some IDEs might require a restart to start recognizing the new module for code-highlighting features and such.
In any source file of the project, add #include "entt.hpp" or any other path to the file from EnTT to use it.
Try to create a registry as entt::registry registry; to make sure everything compiles fine.