[error]UnrealHeaderTool failed for target 'MyProjectEditor'

Why am I getting this error?

I’m fairly certain that this was working fine until I created a class which derived from another, at which point I stopped being able to compile. I’ve since removed the other class, deleted binaries and regenerated the project.

This is such a massive time waste of an issue, and I’m pulling my hair out of this one. I can’t see the forest for the trees, it seems.

My .h file is below for the class that seemed to first have the issue:

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "SpaceApeProjectile.h"
#include "PlayerWeaponComponent.generated.h"    
   

class UObjectPoolComponent;

UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class SPACEAPE_API UPlayerWeaponComponent : public UActorComponent {
	GENERATED_BODY()

public:
	// Sets default values for this component's properties
	UPlayerWeaponComponent();

	void SetObjectPoolReference(class UObjectPoolComponent* _PoolRef);

	// Called every frame
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

	virtual void Shoot(FVector _FireDirection);

	const float WeaponFireRate = 0.14f;


	UObjectPoolComponent* GetObjectPoolReference();

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

	//class ASpaceApeProjectile ProjectileToSpawn;

	TSubclassOf<class ASpaceApeProjectile> ProjectileToSpawn = ASpaceApeProjectile::StaticClass();


	class ASpaceApePlayerCharacter* OwningCharacter;

	UWorld* World;

	// A reference to the character's projectile object pool
	UObjectPoolComponent* PlayerProjectilePoolRef;

};

and the output log:

1>------ Build started: Project: SpaceApe, Configuration: DebugGame_Editor x64 ------
1>  Creating makefile for SpaceApeEditor (UHT file was deleted)
1>C:\Program Files\Epic Games\UE_4.16\Engine\Plugins\Marketplace\ModoMaterialImporter\Source\ModoMaterialImporter\ModoMaterialImporter.Build.cs : warning : Module constructors should take a ReadOnlyTargetRules argument (rather than a TargetInfo argument) and pass it to the base class constructor from 4.15 onwards. Please update the method signature.
1>C:\Program Files\Epic Games\UE_4.16\Engine\Plugins\Marketplace\ModoMaterialImporter\Source\ModoPlugin\ModoPlugin.Build.cs : warning : Module constructors should take a ReadOnlyTargetRules argument (rather than a TargetInfo argument) and pass it to the base class constructor from 4.15 onwards. Please update the method signature.
1>  Parsing headers for SpaceApeEditor
1>    Running UnrealHeaderTool "S:\GitHub\SpaceApe\SpaceApe.uproject" "S:\GitHub\SpaceApe\Intermediate\Build\Win64\SpaceApeEditor\DebugGame\SpaceApeEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
1>  S:/GitHub/SpaceApe/Source/SpaceApe/Components/PlayerWeaponComponent.h(22) : LogWindows:Error: === Critical error: ===
1>  S:/GitHub/SpaceApe/Source/SpaceApe/Components/PlayerWeaponComponent.h(22) : LogWindows:Error:
1>  S:/GitHub/SpaceApe/Source/SpaceApe/Components/PlayerWeaponComponent.h(22) : LogWindows:Error: Assertion failed: FoundClass [File:D:\Build\++UE4+Release-4.16+Compile\Sync\Engine\Source\Programs\UnrealHeaderTool\Private\HeaderParser.cpp] [Line: 5090]
1>  S:/GitHub/SpaceApe/Source/SpaceApe/Components/PlayerWeaponComponent.h(22) : LogWindows:Error:
1>  S:/GitHub/SpaceApe/Source/SpaceApe/Components/PlayerWeaponComponent.h(22) : LogWindows:Error:
1>  S:/GitHub/SpaceApe/Source/SpaceApe/Components/PlayerWeaponComponent.h(22) : LogWindows:Error:
1>  S:/GitHub/SpaceApe/Source/SpaceApe/Components/PlayerWeaponComponent.h(22) : LogWindows:Error:
1>EXEC : error : UnrealHeaderTool failed for target 'SpaceApeEditor' (platform: Win64, module info: S:\GitHub\SpaceApe\Intermediate\Build\Win64\SpaceApeEditor\DebugGame\SpaceApeEditor.uhtmanifest, exit code: CrashOrAssert (3)).
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(37,5): error MSB3073: The command ""C:\Program Files\Epic Games\UE_4.16\Engine\Build\BatchFiles\Build.bat" SpaceApeEditor Win64 DebugGame "S:\GitHub\SpaceApe\SpaceApe.uproject" -waitmutex" exited with code 3.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Okay, the Unreal Header Tool has made it onto my hit list.

A comment caused this…

I’ve stripped out the surrounding code and comments for demonstration purposes, but below is effectively the cause of the problem.

/*
/* <==== this right here caused the UHT to have a fatal error!

*/

I must have done this when copying and pasting the code section; missing the second, closing doxygen.

Thanks goes to CodingMarmot for solving this issue here: https://answers.unrealengine.com/questions/540600/error-assertion-failed-foundclass-fileprivateheade.html