Can't get the Save Game C++ tutorial to compile

Hey Guys, I’ve been trying to learn to make a save state in C++ and for some reason when I try to compile it I get a whole slew of errors. Here’s a link to the tutorial https://docs.unrealengine.com/latest/INT/Gameplay/SaveGame/Code/index.html

Check your MySaveGame.h and look for the class line … change MyProject_API to MYPROJECT_API

Sorry that was an accidental error from all the back and forth copy and paste I have been doing,
I think the code they give you in the tutorial has errors in it because I had to change const to const class in two places. I’m new to this so I’m not sure if that’s right.
Anyway here is what I get now.


Ignore Intellisense “errors”. They’re not issued by a full compile cycle and often can’t cope with the complexity of UE4.

As for the actual error you’re getting, I haven’t integrated 4.6 yet so I’m not familiar with the notation yet, but it seems like you’re using the old style class macro (GENERATED_UCLASS_BODY()) with the new style FObjectInitializer. Replace GENERATED_UCLASS_BODY() with GENERATED_BODY() and see if that helps.

I tried that as well but it wouldn’t compile. How do I select what engine to compile it with?

It looks like you’re using an older version of Unreal Engine (4.5) or earlier, but trying to compile code for the newer versions. The reason I say this is because of the error about FObjectInitializer. Right click on your .uproject file and use “Switch Unreal Engine Version” to make sure you’re targeting the latest version of the editor.

Thanks! That Worked!