# RPC Compile error using FString

**URL:** <https://forums.unrealengine.com/t/rpc-compile-error-using-fstring/410069>\
**Category:** C++\
**Tags:** fstring, rpc, unreal-engine, bug-report, question, CPP\
**Created:** [November 20, 2017, 2:51am UTC](https://forums.unrealengine.com/t/rpc-compile-error-using-fstring/410069 "2017-11-20T02:51:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mctittles](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mctittles](https://forums.unrealengine.com/u/Mctittles)\
**Post date:** [November 20, 2017, 2:51am UTC](https://forums.unrealengine.com/t/rpc-compile-error-using-fstring/410069/1 "2017-11-20T02:51:52Z")

</div>

_Reposted because I meant to put this in bug reports but only did the tag last time not the section_

In my PlayerState I have the following:

.h

```
 UFUNCTION(Server, Reliable, WithValidation) void playerJoined(FString playerNameSent);

```

.cpp

```
 void AMyPlayerState::playerJoined_Implementation(FString playerNameSent) {
     //
 }
 
 bool AMyPlayerState::playerJoined_Validate(FString playerNameSent) {
     return true;
     //
 }

```

When I compile I get the following error:

```
 Severity Code Description Project File Line Suppression State
 Error MSB3075 The command ""C:\Program Files\Epic Games\UE_4.18\Engine\Build\BatchFiles\Build.bat" AudioPartyEditor Win64 Development "C:\Users\Shawn\Documents\Unreal Projects\AudioParty\AudioParty.uproject" -waitmutex" exited with code 5. Please verify that you have sufficient rights to run this command. AudioParty C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets 41    

```

After banging my head against the wall looking for typos I found if I change the type from FString to int32 or even FName then it compiles fine. FString seems to have issues.

---

<div class="post-metadata">

**Author:** ![Mctittles](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mctittles](https://forums.unrealengine.com/u/Mctittles)\
**Post date:** [November 20, 2017, 11:52pm UTC](https://forums.unrealengine.com/t/rpc-compile-error-using-fstring/410069/2 "2017-11-20T23:52:00Z")

</div>

Ok man the docs are fuzzy on this but I found the answer. You need const like so:

UFUNCTION(NetMulticast, Reliable, WithValidation) void playerJoined(const FString& playerNamesSent);

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [November 21, 2017, 6:54pm UTC](https://forums.unrealengine.com/t/rpc-compile-error-using-fstring/410069/3 "2017-11-21T18:54:07Z")

</div>

Hi Mctittles,

Your solution was correct for this error. The error that you showed from the Error List is a generic error. When you see an error like this in the Error List, you should look at what is shown in the Output window. This will usually show you what the actual error is. In this case, you would see this error:

`D:/Unreal Projects/Current Issues/TestFString/Source/TestFString/MyPlayerState.h(19) : LogCompile: Error: Replicated FString parameters must be passed by const reference`
