# How linking work in UE build

**URL:** <https://forums.unrealengine.com/t/how-linking-work-in-ue-build/567110>\
**Category:** C++\
**Tags:** unreal-engine, UE5-0, UE4, CPP, question\
**Created:** [May 26, 2022, 3:00pm UTC](https://forums.unrealengine.com/t/how-linking-work-in-ue-build/567110 "2022-05-26T15:00:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon47586833](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon47586833](https://forums.unrealengine.com/u/anon47586833)\
**Post date:** [May 26, 2022, 3:00pm UTC](https://forums.unrealengine.com/t/how-linking-work-in-ue-build/567110/1 "2022-05-26T15:00:08Z")

</div>

I happen to have a situation where there’s 3 Public and Private DependencyModuleNames with comment stating which PublicDependencyModuleNames is for the game, plugin etc  
In .build.cs

> PublicDependencyModuleNames.AddRange(new string { SlateCore});  
> PublicDependencyModuleNames.AddRange(new string { });  
> PublicDependencyModuleNames.AddRange(new string { });  
> PrivateDependencyModuleNames.AddRange(new string {Slate });  
> PrivateDependencyModuleNames.AddRange(new string { });  
> PrivateDependencyModuleNames.AddRange(new string { });  
> and each has different modules for different parts of the project

and I have

> error LNK2019: unresolved external symbol “\_\_declspec(dllimport) public: static class ISlateStyle const & \_\_cdecl ::Get(void)” (\__imp_?Get@@@SAAEBVISlateStyle@@anonymous_user_9674a66c) referenced in function “public: virtual void \_\_cdecl MyClass::CustomizeDetails(class IDetailLayoutBuilder &)” (?CustomizeDetails@MyClass@@UEAAXAEAVIDetailLayoutBuilder@@@Z)

I also tried to have both of them in public and in private but it didnt work

so how does unreal engine knows that the second one should be for the plugin and the third one for the game

---

<div class="post-metadata">

**Author:** ![jojothebandit](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jojothebandit](https://forums.unrealengine.com/u/jojothebandit)\
**Post date:** [May 26, 2022, 3:42pm UTC](https://forums.unrealengine.com/t/how-linking-work-in-ue-build/567110/2 "2022-05-26T15:42:44Z")

</div>

I am open to someone correcting me if I’m wrong, but basically you’re always building the project.  
A plugin is just dependency code for the project being built  
So ultimately, UE build doesn’t care, it just gathers all the modules it needs to load (which it find by reading all the included build.cs files) and compiles them.  
A module is the same whether it’s stated in the plugin build or the project build, so it will be included either way

---

<div class="post-metadata">

**Author:** ![anon47586833](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon47586833](https://forums.unrealengine.com/u/anon47586833)\
**Post date:** [May 26, 2022, 3:44pm UTC](https://forums.unrealengine.com/t/how-linking-work-in-ue-build/567110/3 "2022-05-26T15:44:13Z")

</div>

so you are saying that it will combine all PublicDependencyModuleNames and link it to the project?

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [May 26, 2022, 3:46pm UTC](https://forums.unrealengine.com/t/how-linking-work-in-ue-build/567110/4 "2022-05-26T15:46:07Z")

</div>

As per @jojothebandit , it’s like an array, and it doesn’t matter how many lines you use to add modules. They all will end up in one array.

As for the second part of your question, you’re adding strings, so they should be “SlateCore” and “Slate”, i.e. in double quotes.

---

<div class="post-metadata">

**Author:** ![anon47586833](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon47586833](https://forums.unrealengine.com/u/anon47586833)\
**Post date:** [May 26, 2022, 3:47pm UTC](https://forums.unrealengine.com/t/how-linking-work-in-ue-build/567110/5 "2022-05-26T15:47:28Z")

</div>

Thanks, so it’s just style to have clean code  
and yes they are strings, this is just a mock up

---

<div class="post-metadata">

**Author:** ![jojothebandit](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jojothebandit](https://forums.unrealengine.com/u/jojothebandit)\
**Post date:** [May 26, 2022, 3:50pm UTC](https://forums.unrealengine.com/t/how-linking-work-in-ue-build/567110/6 "2022-05-26T15:50:03Z")

</div>

> [@anon47586833](#):
>
> unresolved external symbol

This in most cases means you have the declaration(the .h file) but not the definition (the .cpp file) so check out why the module is included and not linked.  
This can happen if the module does not allow you to use it (it didn’t expose the method) or it’s a private module or something similar

---

<div class="post-metadata">

**Author:** ![anon47586833](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon47586833](https://forums.unrealengine.com/u/anon47586833)\
**Post date:** [May 26, 2022, 3:51pm UTC](https://forums.unrealengine.com/t/how-linking-work-in-ue-build/567110/7 "2022-05-26T15:51:59Z")

</div>

> [@jojothebandit](#):
>
> means you have the declaration(the .h file) but not the defi

I doubt this is the case because my code works without my custom slate UI
