# How to skip code when compiling dedicated server?

**URL:** <https://forums.unrealengine.com/t/how-to-skip-code-when-compiling-dedicated-server/2347539>\
**Category:** Getting Started & Setup\
**Tags:** unreal-engine, question\
**Created:** [February 20, 2025, 11:27pm UTC](https://forums.unrealengine.com/t/how-to-skip-code-when-compiling-dedicated-server/2347539 "2025-02-20T23:27:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [February 20, 2025, 11:27pm UTC](https://forums.unrealengine.com/t/how-to-skip-code-when-compiling-dedicated-server/2347539/1 "2025-02-20T23:27:41Z")

</div>

I’m building dedicated server for the first time.

For now the only thing I’ve done is create my file  
`MyProjectServer.Target.cs`  
And compile

I have an error when compiling that I don’t have when compiling the client/listen

`error C2039: "ShiftChild": is not a member of "UVerticalBox"`

I know that the dedicated server doesn’t render, it doesn’t have widgets, sounds, particles and stuff like that…

I just want to know how I can make it skip unnecessary code at compile time.

Should I to use some predefined macro definitions wirh Preprocessor directives?  
If so, what is the definition?

Otherwise… how should I handle this correctly?

Thank you so much!!

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [February 21, 2025, 12:01am UTC](https://forums.unrealengine.com/t/how-to-skip-code-when-compiling-dedicated-server/2347539/2 "2025-02-21T00:01:08Z")

</div>

Ok, i found this publication

Seems it let me compile without errors…

```auto
#if !WITH_SERVER_CODE
	Container->ShiftChild(0, Widget);
#endif // WITH_SERVER_CODE

```

I just hope it does not omit the code for listen server

> [@Dedicated server code split from client code](https://forums.unrealengine.com/t/dedicated-server-code-split-from-client-code/7446/2):
>
> The key to this is the Server and Client code configuration. So to build a cooked client that doesn’t have access to dedicated server code you can build “Development Client”, which is almost the same as “Development” but with server-only code disabled. What this does is set the WITH\_SERVER\_CODE define to false. When this is false various things like server-side networking are compiled out in the engine. There is no client-only configuration with editor functionality enabled, so this only works w…

Thank you so much @Ben_Zeigler

* * *

Edited 1:

I don’t understand why only this function generated errors.  
I have many widgets in my project.  
Can someone explain if I really need to skip code?  
I mean… maybe all the widget code is set up to be skipped by default.  
And for some reason they forgot to skip this function → ShiftChild();  
Or should I skip the code even if I don’t get any errors when compiling?

Thank you so much !!

* * *

* * *

Edited 2:

Well… I found the reason for the compilation error.

 ![0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/8/5/c8580fb5228cf2baace63eab904470e4f3f06534.png)

This isn’t going to work in the shipping version, right? 🤦‍♂️

* * *

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [March 23, 2025, 12:01am UTC](https://forums.unrealengine.com/t/how-to-skip-code-when-compiling-dedicated-server/2347539/3 "2025-03-23T00:01:18Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
