I’m trying to understand how to structure and implement a larger project. As I want to create a multiplayer FPS, the ShooterGame demo project a good place to start.
However, I’ve become stuck trying to implement one particular set of files from ShooterGame.
In the ShooterGame Public folder, there is the file ShooterTypes.h which defines various namespaces and structs which are used by other classes. The struct FTakeHitInfo has a set of functions (constructor and few others) which are subsequently defined in the file TakeHitInfo.cpp in folder Private.
When I try and implement identical files in my own project, the compiler complains that it expected TakeHitInfo.h to be the first file included in TakeHitInfo.cpp. However, no other errors are thrown while editing and going back and forth from declaration to definition, Visual Studio seems to understand that the content in TakeHitInfo.cpp is declared in ShooterTypes.h. But when trying to build the project, it clearly still wants there to be a TakeHitInfo.h file. In ShooterGame, there is no TakeHitInfo header file and the project compiles without error.
Naively, I’m guessed that, within the ShooterGame project there is something that explicitly says “These functions declared in ShooterTypes.h are going to be defined in TakeHitInfo.cpp” but I have searched fruitlessly for any such linkage.
Questions: Does anyone know how exactly this has been implemented within ShooterGame and how such an implementation can be replicated in another project?
Aside-Question (but probably quite important): is it common/reasonable to inact this kind of implementation? i.e. have a bunch of functions defined in a .cpp that has a different name from its .h