How to skip code when compiling dedicated server?

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!!

Ok, i found this publication

Seems it let me compile without errors…

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

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

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.

This isn’t going to work in the shipping version, right? :man_facepalming: