Uproperty not defined

Hi, I’m having trouble getting Uproperty to work for a pawn. when I try to build and run my code commenting UPROPERTY() out everything runs fine but when UPROPERTY is not commented my code fails and it seems that it is not defined. I’m trying to follow this tutorial on youtube. I think I need to include something but I don’t know what, looking at the documentation isn’t helping me. here is the code:

// Fill out your copyright notice in the Description page of Project Settings.
// able to read input
#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "PlayerCam.generated.h"

UCLASS()
class TUTORIAL_API APlayerCam : public APawn
{
	GENERATED_BODY()

public:
	// Sets default values for this pawn's properties
	APlayerCam();

	UPROPERTY(EditAnywhere);
	UStaticMeshComponent* CubeMesh;

	UPROPERTY(EditAnywhere);
	class UCameraComponent* Cam;

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

	// Called to bind functionality to input
	virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

	void MoveForward(float Value);
	void MoveRight(float Value);
};

this could be cause by some wrong includes within your solution project. your code is correct event though some code should probably be protected instead of being public but not a reason for your code to fail.

Check if all the following folders are part of your solution:
/PATH/TO/SOLUTION/ProjectName/Intermadiate/Build/PLATFORM[/B4D820EA{If you are on Linux}]/AnyFolderThatContainsInc/Inc/AnyFolderHere

Some missing precompiled headers may cause this issue.

thanks , but how can I do that in visual studio? also I have an actor that is using UPROPERTY and its not having any problems running

Can’t believe I missed that… Remove the semicolons after UPROPERTY()