UnrealHeaderTool failed for target 'ProjectName'

Hey all, I’m pretty new to Unreal 4 so I’m trying out a few tutorials online. I’ve built two different classes (Base_Character and Player_Character), Here is the .cpp and .h files for both:

Base_Character.h

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "Base_Character.generated.h"

UCLASS()
class CPP_PACKTTUT_API ABase_Character : public ACharacter
{
	GENERATED_BODY()

public:
	// Sets default values for this character's properties
	ABase_Character();

	UFUNCTION(BlueprintCallable, Category = "Character|Health")
		void SetCurrentHealth(float NewHealth) { CurrentHealth = NewHealth; }

	UFUNCTION(BlueprintPure, Category = "Character|Health")
		float GetCurrentHealth() const { return CurrentHealth; }

	UFUNCTION(BlueprintPure, Category = "Character|Health")
		float GetMaxHealth() const { return MaxHealth; }

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

	UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Character|Death")
		void OnDeath();
	virtual void OnDeath_Implementation() PURE_VIRTUAL(ABase_Character::OnDeath_Implementation, );

	float CurrentHealth;
	
	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Character|Health")
		float MaxHealth;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Character")
		bool bIsSprinting;
};

Player_Character.h

#pragma once

#include "CoreMinimal.h"
#include "Characters/Base_Character.h"
#include "Player_Character.generated.h"

/**
 * 
 */
UCLASS()
class CPP_PACKTTUT_API APlayer_Character : public ABase_Character
{
	GENERATED_BODY()

public: 
	
	APlayer_Character();

	UFUNCTION(BlueprintPure, Category = "Character|Gun|Ammo")
		int32 GetCurrentAmmo() const { return CurrentAmmo; }

	UFUNCTION(BlueprintPure, Category = "Character|Gun|Ammo")
		int32 GetMaxAmmo() const { return MaxAmmo; }

	UFUNCTION(BlueprintCallable, Category = "Character|Gun|Ammo")
		int32 SetCurrentAmmo(int NewAmmo) { CurrentAmmo = NewAmmo; }

	UPROPERTY(BlueprintReadOnly, VisibleDefaultOnly, Category = "Components", meta = (AllowPrivateAccess = "true"))
		class USpringArmComponent* SpringArm;
	UPROPERTY(BlueprintReadOnly, VisibleDefaultOnly, Category = "Components", meta = (AllowPrivateAccess = "true"))
		class UCameraComponent* Camera;
	UPROPERTY(BlueprintReadOnly, VisibleDefaultOnly, Category = "Components", meta = (AllowPrivateAccess = "true"))
		class USkeletalMeshComponent* FP_Mesh;
	UPROPERTY(BlueprintReadOnly, VisibleDefaultOnly, Category = "Components", meta = (AllowPrivateAccess = "true"))
		class USkeletalMeshComponent* GunMesh;

protected:
	virtual void BeginPlay() override;
	virtual void SetupPlayerInputComponent(UInputComponent * PlayerInputComponent) override;

	virtual void OnDeath_Implementation() override;

	bool HasAmmo() const { return (CurrentAmmo > 0); }

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Character|Gun")
		bool bCanShoot;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Character|Gun|Ammo")
		bool bUnlimitedAmmo;

	int CurrentAmmo;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Character|Gun|Ammo")
		int MaxAmmo;
};

Whenever I try to rebuild this in Visual Studio, I get the following errors:

  Severity	Code Description	Project	File	Line	Suppression State
  Error UnrealHeaderTool failed for target 'CPP_PacktTutEditor' (platform: Win64, module info: C:\Users\Sean\Dev\CPP_PacktTut\Intermediate\Build\Win64\CPP_PacktTutEditor\Development\CPP_PacktTutEditor.uhtmanifest, exit code: OtherCompilationError (5)).	CPP_PacktTut	C:\Users\Sean\Dev\CPP_PacktTut\Intermediate\ProjectFiles\EXEC	1	
    
    Severity	Code	Description	Project	File	Line	Suppression State
    Error	MSB3073	The command ""C:\Program Files\Epic Games\UE_4.19\Engine\Build\BatchFiles\Rebuild.bat" CPP_PacktTutEditor Win64 Development "C:\Users\Sean\Dev\CPP_PacktTut\CPP_PacktTut.uproject" -WaitMutex -FromMsBuild" exited with code -1.	CPP_PacktTut	C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets	49	

Also, here is my build log for the project:

1>------ Rebuild All started: Project: UE4, Configuration: BuiltWithUnrealBuildTool Win32 ------
2>------ Rebuild All started: Project: CPP_PacktTut, Configuration: Development_Editor x64 ------
2>Cleaning CPP_PacktTutEditor Binaries...
2>Creating makefile for CPP_PacktTutEditor (no existing makefile)
2>Performing full C++ include scan (no include cache file)
2>Parsing headers for CPP_PacktTutEditor
2>  Running UnrealHeaderTool "C:\Users\Sean\Dev\CPP_PacktTut\CPP_PacktTut.uproject" "C:\Users\Sean\Dev\CPP_PacktTut\Intermediate\Build\Win64\CPP_PacktTutEditor\Development\CPP_PacktTutEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
2>C:/Users/Sean/Dev/CPP_PacktTut/Source/CPP_PacktTut/Public/Characters/Player_Character.h(30) : LogCompile: Error: Unknown variable specifier 'VisibleDefaultOnly'
2>C:/Users/Sean/Dev/CPP_PacktTut/Source/CPP_PacktTut/Public/Characters/Player_Character.h(32) : LogCompile: Error: Unknown variable specifier 'VisibleDefaultOnly'
2>C:/Users/Sean/Dev/CPP_PacktTut/Source/CPP_PacktTut/Public/Characters/Player_Character.h(34) : LogCompile: Error: Unknown variable specifier 'VisibleDefaultOnly'
2>C:/Users/Sean/Dev/CPP_PacktTut/Source/CPP_PacktTut/Public/Characters/Player_Character.h(36) : LogCompile: Error: Unknown variable specifier 'VisibleDefaultOnly'
2>EXEC : error : UnrealHeaderTool failed for target 'CPP_PacktTutEditor' (platform: Win64, module info: C:\Users\Sean\Dev\CPP_PacktTut\Intermediate\Build\Win64\CPP_PacktTutEditor\Development\CPP_PacktTutEditor.uhtmanifest, exit code: OtherCompilationError (5)).
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(49,5): error MSB3073: The command ""C:\Program Files\Epic Games\UE_4.19\Engine\Build\BatchFiles\Rebuild.bat" CPP_PacktTutEditor Win64 Development "C:\Users\Sean\Dev\CPP_PacktTut\CPP_PacktTut.uproject" -WaitMutex -FromMsBuild" exited with code -1.
2>Done building project "CPP_PacktTut.vcxproj" -- FAILED.
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========

I know this is probably a pretty vague question so let me know if I need to clear something up!

You sure thats allfrom logs? Is there maybe something more? Could you give full log? Also you could try deleting Intermidiate files and regenerate VS project files after it

Hey , I’ve updated the question with my project log info :slight_smile:

You have a few variables in your player character with

VisibleDefaultOnly

It needs to be

VisibleDefaultsOnly