x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

RPC Compile error using FString

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.

Product Version: UE 4.18
Tags:
more ▼

asked Nov 20 '17 at 02:51 AM in Bug Reports

avatar image

Mctittles
66 4 10 14

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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);

more ▼

answered Nov 20 '17 at 11:52 PM

avatar image

Mctittles
66 4 10 14

avatar image Tim C ♦♦ STAFF Nov 21 '17 at 06:54 PM

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

Tim

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question