Hi guys I hope everybody is doing great with their projects.
So I want to declared a function inside of the header GenericApplication.h which is already #included in most of Runtime modules. Then I’d like to define the function in WindowsApplication.h because it needs winapi types and structs. All went good. Until I tried to call the function from GameInstance.cpp which already #includes GenericApplication.h header by default.
Here is the exact code for clarification:
In GenericApplication.h:
namespace InputSystemPrototypeNS
{
extern APPLICATIONCORE_API void InitializeInputSystem();
}
Then inside WindowsApplication.cpp:
void InputSystemPrototypeNS::InitializeInputSystem()
{
//...
}
Finally inside GameInstance.cpp:
...
void UGameInstance::Init()
{
...
InputSystemPrototypeNS::InitializeInputSystem();
}
...
This will lead to an undefined external linkage error in the GameInstance function.