# \[4.7p2\] server rpc declaration?

**URL:** <https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [January 9, 2015, 12:01pm UTC](https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459 "2015-01-09T12:01:53Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [January 9, 2015, 12:01pm UTC](https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459/1 "2015-01-09T12:01:53Z")

</div>

Hey all,

How am i supposed to deal with server rpc declaration in 4.7 ?

I have a ton of warnings like that one:

```
warning C4996: Function YagActor::ServerSetBodyTexturePath needs native implementation by virtual void ServerSetBodyTexturePath_Implementation(const FString& NewBodyTexturePath) due to its properties.

```

Maybe it is obvious and self explanatory but i am not a big guy in c++ and couldn’t find a way to get rid of those.

Could anyone give me an example of how server rpc should be declared since 4.7 ?

Thanks !

---

<div class="post-metadata">

**Author:** ![eXi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/exi/32/906583_2.png) [@eXi](https://forums.unrealengine.com/u/eXi)\
**Post date:** [January 9, 2015, 12:16pm UTC](https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459/2 "2015-01-09T12:16:43Z")

</div>

Seeing your code would be nice, otherwise it’s hard to tell what you may did wrong. Did your declaration work in 4.6? If not, have you checked this wiki article?

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

---

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [January 9, 2015, 12:23pm UTC](https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459/3 "2015-01-09T12:23:48Z")

</div>

Hi,

Here is the code.

```
UFUNCTION(Server, WithValidation, Reliable)
	void ServerSetBodyTexturePath(const FString& NewBodyTexturePath);

--------------------------------------------------------------------------------------------------

bool AYagActor::ServerSetBodyTexturePath_Validate(const FString& NewBodyTexturePath)
{
	return true;
}

void AYagActor::ServerSetBodyTexturePath_Implementation(const FString& NewBodyTexturePath)
{
	bla bla
}

```

It has been working forever, 4.6 included, so i thought it was a 4.7 change.

Cheers

---

<div class="post-metadata">

**Author:** ![eXi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/exi/32/906583_2.png) [@eXi](https://forums.unrealengine.com/u/eXi)\
**Post date:** [January 9, 2015, 12:34pm UTC](https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459/4 "2015-01-09T12:34:35Z")

</div>

Hmpf, i’,m not that good in C++, but i can’t find examples with “virtual” replicated functions. Would you mind trying to declare it without the “virtual”? :X

---

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [January 9, 2015, 12:36pm UTC](https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459/5 "2015-01-09T12:36:18Z")

</div>

sorry, that was a typo, one of my tries to get rid of the warnings 😃  
I have corrected the posted code^^

---

<div class="post-metadata">

**Author:** ![eXi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/exi/32/906583_2.png) [@eXi](https://forums.unrealengine.com/u/eXi)\
**Post date:** [January 9, 2015, 1:08pm UTC](https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459/6 "2015-01-09T13:08:06Z")

</div>

I don’t have 4.7 here at the moment. How about you add virtual back to it and also to the

```
virtual void AYagActor::ServerSetBodyTexturePath_Implementation(const FString& NewBodyTexturePath)
 {
     bla bla
 }

```

But i’m just guessing here :X Would be better to maybe ask in the 4.7 Preview forum thread.

---

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [January 9, 2015, 1:14pm UTC](https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459/7 "2015-01-09T13:14:28Z")

</div>

Already tried that, unfortunately i get a compilation error.

Yeah, i’ll wait a bit and if nobody has a better idea here, i’ll try the forum.

Anyway, thanks a lot for your time and suggestions 🙂

---

<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:** [January 16, 2015, 8:06pm UTC](https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459/8 "2015-01-16T20:06:33Z")

</div>

Hi uced,

Sorry for not responding to your post sooner. Are you seeing the warnings that you mentioned in Visual Studio when you try to build your project? I just tried adding the code you provided above and was able to build a project without any problems in 4.7 Preview 3. Have you run into the same warnings in Preview 3?

---

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [January 16, 2015, 8:31pm UTC](https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459/9 "2015-01-16T20:31:04Z")

</div>

Hi ,

Thanks for your answer.

Yes, i’m using visual studio + 4.7 preview 3 (launcher version) and still have the warnings so far.

They didn’t exist before, they appeared suddenly in 4.7 (p1, p2, p3) with no change in the code. First time i compiled in 4.7 they appeared, i thought i was the normal “get rid of the warnings in new version” routine, except i couldn’t get rid of them^^

There has been some discussion about it in the forum:

> **[How do i code server rpc in 4.7 ?](https://forums.unrealengine.com/showthread.php?56211-How-do-i-code-server-rpc-in-4-7)**
>
> Hey guys, How am i supposed to deal with server rpc in 4.7 ? I have a ton (one for each rpc) of warnings like that one: warning C4996: Function YagActor::ServerSetBodyTexturePath needs native implementation by virtual void...

At least one other person is experiencing this problem:

> **[ImplementationDeclaration](https://forums.unrealengine.com/showthread.php?56194-ImplementationDeclaration)**
>
> Hi, I’ve just finished Lauren’s youtube tutorial series gettings started C++. Since then alot has changed with the engine. I wanted to fix warnings. I don’t understand what I’m supposed to do about this warning: Im on UE4.7 Preview 2 Best...

I have one warning per server rpc. Strangely enough, sometimes the same list or warnings repeats itself many times, resulting in a huge number of warning lines, sometimes i get only one copy of the list, that seems random, i couldn’t identify a trigger.

Long story short: no clue, 2 people has the pb as far as i know, but most don’t apparently.

Chances are strong that i am doing something wrong, but i am short of ideas now.

Cheers

---

<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:** [January 16, 2015, 9:04pm UTC](https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459/10 "2015-01-16T21:04:14Z")

</div>

I think I was able to see the warning messages that you described. However, I only get them when I do a Rebuild in Visual Studio. If I do a standard Build, the messages don’t appear. Do you see them even when doing a regular Build?

---

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [January 16, 2015, 9:16pm UTC](https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459/11 "2015-01-16T21:16:06Z")

</div>

I am still discovering c++ and VS (in french !), so just to be clear for me: if they are the commands associated with F7 (build) and ctrl-alt-F7 (rebuild) then yes, i used both of them extensively many many time (sometimes with some “cleaning the solution”) and the warnings never disappear.

---

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [January 17, 2015, 9:29am UTC](https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459/12 "2015-01-17T09:29:50Z")

</div>

Hi ,

I made some more careful tests and read about build/rebuild, it now makes more sense.

When i build, i get the warnings from the headers parsed in modified files only. That’s why the number seemed random, it actually is depending on the files i modified before building.

When i rebuild, i get the full list of warnings for each headers in all the project.

If the same header appears many times in the project, its list of warnings will be repeated as much.

So in short, it gives a warning for each rpc it encounters in the headers parsed during builing/rebuilding.

So if you modify only a file that does not include any “declaring-rpcs-header”, you will get no warnings (i did this on a dummy file).

If you modify a file containing somehow (through included headers) server rpcs declaration, i bet you will get the warning even on a simple build.

Hope it helps.

Cheers

---

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [January 22, 2015, 10:24am UTC](https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459/13 "2015-01-22T10:24:08Z")

</div>

Warnings are still there in preview 4.

---

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [January 25, 2015, 1:15pm UTC](https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459/14 "2015-01-25T13:15:57Z")

</div>

I have started a brand new code (4.7p4 / c++ / basic code), just added an AActor derived class with this code

```
UFUNCTION(server, withvalidation, reliable)
	void ServerMove(FVector Velocity, bool bSweep);

-------------------------------------------------------------------------------------

bool ASpider::ServerMove_Validate(FVector Velocity, bool bSweep){ return true; }
void ASpider::ServerMove_Implementation(FVector Velocity, bool bSweep)
{
	AddActorWorldOffset(Velocity, bSweep);
}

```

Et voila:

```
1>C:\Users\\Documents\Unreal Projects\SpiderTest\Source\SpiderTest\Spider/Spider.h(14)( : warning C4996: Function Spider::ServerMove needs native implementation by virtual void ServerMove_Implementation(FVector Velocity, bool bSweep) due to its properties. Currently ServerMove_Implementation declaration is autogenerated by UHT. Since next release you'll have to provide declaration on your own. Please update your code before upgrading to the next release, otherwise your project will no longer compile.

```

All this was made in 4.7 preview 4.

---

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [January 26, 2015, 11:20am UTC](https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459/15 "2015-01-26T11:20:20Z")

</div>

Hi,

This code is working:

```
UFUNCTION(server, withvalidation, reliable)
	void ServerMove(FVector Velocity, bool bSweep); 
virtual bool ServerMove_Validate(FVector Velocity, bool bSweep);
virtual void ServerMove_Implementation(FVector Velocity, bool bSweep);

```

Could anyone from epic staff please confirm that this is correct and should be used for rpc declarations from now on ?

Thanks

---

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [January 26, 2015, 8:35pm UTC](https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459/16 "2015-01-26T20:35:49Z")

</div>

All right, this is official now, the whole story is here:

> **[How do i code server rpc in 4.7 ?](https://forums.unrealengine.com/showthread.php?56211-How-do-i-code-server-rpc-in-4-7)**
>
> Hey guys, How am i supposed to deal with server rpc in 4.7 ? I have a ton (one for each rpc) of warnings like that one: warning C4996: Function YagActor::ServerSetBodyTexturePath needs native implementation by virtual void...

---

<div class="post-metadata">

**Author:** ![Star\_Dust](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Star\_Dust](https://forums.unrealengine.com/u/Star_Dust)\
**Post date:** [March 9, 2015, 11:48pm UTC](https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459/17 "2015-03-09T23:48:02Z")

</div>

uced, thank you for working through this issue. I missed out on the 4.7 previews, but ran into these warnings in the release versions. Your forum post and topic here helped resolve the problem quickly (I too was getting fail to compiles for a while with the \_Validate not included.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3ecd6c40](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3ecd6c40](https://forums.unrealengine.com/u/anonymous_user_3ecd6c40)\
**Post date:** [March 10, 2015, 7:44am UTC](https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459/18 "2015-03-10T07:44:26Z")

</div>

Hi,

you get this Warning because auf the changes they made in Version 4.7. Klick here for an answer: [Link](https://answers.unrealengine.com/questions/187496/cant-use-blueprintnativeevent-int-472.html)

In 4.7+ your header has to look linke this:

```
UFUNCTION(...)
virtual void ServerSetBodyTexturePath(const FString& NewBodyTexturePath)
virtual void ServerSetBodyTexturePath_Implementation(const FString& NewBodyTexturePath)

```

---

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [March 10, 2015, 8:13am UTC](https://forums.unrealengine.com/t/4-7p2-server-rpc-declaration/303459/19 "2015-03-10T08:13:55Z")

</div>

Hey Ra\_ar, thanks for the feedback, always glad to be helpful 🙂
