# Linking error when exporting component

**URL:** <https://forums.unrealengine.com/t/linking-error-when-exporting-component/280972>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [April 18, 2014, 1:48pm UTC](https://forums.unrealengine.com/t/linking-error-when-exporting-component/280972 "2014-04-18T13:48:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DanKolle](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dankolle/32/1086423_2.png) [@DanKolle](https://forums.unrealengine.com/u/DanKolle)\
**Post date:** [April 18, 2014, 1:48pm UTC](https://forums.unrealengine.com/t/linking-error-when-exporting-component/280972/1 "2014-04-18T13:48:23Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![gmpreussner\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@gmpreussner\_1](https://forums.unrealengine.com/u/gmpreussner_1)\
**Post date:** [April 18, 2014, 1:55pm UTC](https://forums.unrealengine.com/t/linking-error-when-exporting-component/280972/2 "2014-04-18T13:55:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DanKolle](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dankolle/32/1086423_2.png) [@DanKolle](https://forums.unrealengine.com/u/DanKolle)\
**Post date:** [April 18, 2014, 2:24pm UTC](https://forums.unrealengine.com/t/linking-error-when-exporting-component/280972/3 "2014-04-18T14:24:31Z")

</div>

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.
