UPROPERTY compile error

When i test the UPROPERTY,then compile error in vs2013!
this is my cod:

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "GameFramework/Actor.h"
#include "MyActor.generated.h"

UCLASS()
class UETEST_API AMyActor : public AActor
{
	GENERATED_BODY()
    
		UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Damage")
		int32 TotalDamage;

	    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Damage")
		float DamageTimeInSeconds;

	    UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Transient, Category = "Damage")
		float DamagePerSecond;
	
public:	
	// Sets default values for this actor's properties
	AMyActor();

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

	
	
};

the error:

Error 2 error MSB3073: The command ““D:\Program Files\Epic Games\4.8\Engine\Build\BatchFiles\Build.bat” UETestEditor Win64 Development “D:\Project\ue4\UETest\UETest.uproject” -rocket” exited with code -1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets 38

Error 1 error code: OtherCompilationError (5) D:\Project\ue4\UETest\Intermediate\ProjectFiles\Error

Who met this error? thanks!

Don’t you have any other errors before that? Those are errors from Output tab right?

Yes,not have any other errors.When i annotation the UPROPERTY code,it can compile success!The code is from the link:Introduction to C++ Programming in UE4

Hello,

I believe you can’t have a BlueprintReadWrite variable as a private field.
GENERATED_BODY() since the 4.7 now assumes the default is private for C++ classes, as in usual C++ code.

So, to solve this, be sure to declare your BlueprintReadWrite fields as public.
You should take those fields and get them under the public: section, at the end of your class.

Remember that you can also declare different public: / private: / protected: sections.

For example, I had the code for that like in the following image, because I like to have all my variables at the top, followed by the functions.

http://puu.sh/iHEfw/8f1afd183c.png

Hi,

You are right! When declare BlueprintReadWrite fields as public,it compile success!

Thank you very much!