Cannot build with RPCs

I am just coming back to UE4 after last working with 4.5. I’m currently using 4.9.1 and I am unable to build any code with RPCs in it. Based on the transition guides on the c++ forums, the way they are declared has changed, but even doing so it will not compile.

class UE4PLAYGROUND_API ANetTest : public AActor
  // Sets default values for this actor's properties

  // Called when the game starts or when spawned
  virtual void BeginPlay() override;
  // Called every frame
  virtual void Tick( float DeltaSeconds ) override;

  // Old Implementation, doesn't work. Expected.
  //UFUNCTION(Server, Reliable, WithValidation)
  //void RPC1();

  UFUNCTION(Server, Reliable, WithValidation)
  void RPC2();
  bool RPC2_Validate();
  void RPC2_Implementation();

  // Newest implementation
  //UFUNCTION(Reliable, Server = "RPC3_I", WithValidation = "RPC3_V")
  //void RPC3();
  //bool RPC3_V();
  //void RPC3_I();

As you can see, I tried all 3 methods to no avail. RPC1 doesn’t work for the obvious lack of declaration of the validate and implementation functions. RPC2 and RPC3 generate the following error:

1>\UE4Playground.generated.cpp.obj : error LNK2005: “public: void __cdecl ANetTest::RPC2(void)” (?RPC2@ANetTest@@QEAAXXZ) already defined in NetTest.cpp.obj

I have tried deleting the previous build before building.
Name does not have any bearing on the result. Creating a new class does nothing. I was able to get it to build with a separate project using GENERATED_UCLASS_BODY and the pre 4.7 style declaration even though I’m pretty sure both were supposed to be deprecated. Regardless, that is not the case in this project, it fails either way. Not sure if this is me doing something stupid or if I have a corrupt build.

In your Header you only have the serverWhatShallBeDone or in your case (you should change it) RPCx_Bla function.

You don’t write any implementation for this function.

The implementation is given from the framework.
But the implementation from the framework will call the _Implementation() _Validate() functions, so you have to implement these. You do not declare them in the header you only implement them in the .cpp file.
Which ones you need depends on your use of “WithValidation”.

Example: .h

UFUNCTION(Server, Reliable, WithValidation)
  void serverDo(int nIndex);

Example .cpp

 YourClass:serverDo_Implementation(int nIndex)
       // here is the real code which does thingies

 YourClass:serverDo_Validate(int nIndex)
       const MAX_GOOD_INDEX = 5;
       if (nIndex >= 0 && nIndex <= MAX_GOOD_INDEX)
              return true;

      return false;

I wrote this code without the use of the IDE and without compiling it. So please understand there might be spelling errors in the method names etc.