Linking error when exporting component

I created a new module with a component. When I export a function of that component and use it in ShooterGame everything works fine.

UCLASS( ClassGroup=Shapes, BlueprintType, HideCategories=(Object, ActorComponent, Physics, Rendering, Mobility, LOD), ShowCategories=Trigger, meta=(BlueprintSpawnableComponent) )
class UMyComponent : public USceneComponent
{
	GENERATED_UCLASS_BODY()

	UFUNCTION(BlueprintCallable, Category="Something")
	MYMODULE_API void DoSomething();
};

When I now export the whole class instead of just the function, I get a linking error:

UCLASS( ClassGroup=Shapes, BlueprintType, HideCategories=(Object, ActorComponent, Physics, Rendering, Mobility, LOD), ShowCategories=Trigger, meta=(BlueprintSpawnableComponent) )
class MYMODULE_API UMyComponent : public USceneComponent
{
	GENERATED_UCLASS_BODY()

	UFUNCTION(BlueprintCallable, Category="Something")
	void DoSomething();
};

Error	1	error LNK2019: unresolved external symbol "private: static class UClass * __cdecl UMyComponent::GetPrivateStaticClass(wchar_t const *)" (?GetPrivateStaticClass@UMyComponent@@CAPEAVUClass@@PEB_W@Z) referenced in function "public: static void * __cdecl UMyComponent::operator new(unsigned __int64,class UObject *,class FName,enum EObjectFlags)" (??2UMyComponent@@SAPEAX_KPEAVUObject@@VFName@@W4EObjectFlags@@@Z)	UE4\Engine\Intermediate\ProjectFiles\Module.MyModule.cpp.obj

The weird thing is that the linking error is not coming from ShooterGame where the function is used but from my own module which contains the CPP file with the constructor and everything.

Any suggestion why GetPrivateStaticClass is not found by the linker linking the module which contains the actual class?

Looks like you’re missing an #include “MyModule.generated.inl” in your module’s .cpp file.

Thanks that fixed it. I think I read about this before but I did not realise that there is also a generated file for the module itself.