I’m experiencing an error during the code generation phase of building my project. I added an actor via the UE4.1 C++ wizard, named AProjectileBasicExplosion
. Following the first person template for Projectile.h
, I created the following header file:
#pragma once
#include "GameFramework/Actor.h"
#include "ProjectileBasicExplosion.generated.h"
/**
* Explosion actor
*/
UCLASS(config=Game)
class AProjectileBasicExplosion : public AActor
{
GENERATED_UCLASS_BODY()
/** Explosion Particle Component */
UPROPERTY(VisibleAnywhere, Category=Particle)
TSubobjectPtr<ParticleSystemComponent> ExplosionParticles;
/** Force Component */
UPROPERTY(VisibleAnywhere, Category=Force)
TSubobjectPtr<RadialForceComponent> ExplosionForce;
UFUNCTION()
void Explode();
};
Upon compiling, I receive the following failure:
1>------ Rebuild All started: Project: FugitiveRush, Configuration: Development_Editor x64 ------
1> Cleaning FugitiveRushEditor Binaries...
1> Parsing headers for FugitiveRushEditor
1>C:/Users/Axel/Documents/Unreal Projects/FugitiveRush/Source/FugitiveRush/ProjectileBasicExplosion.h(18): error : In ProjectileBasicExplosion: Unrecognized type 'TSubobjectPtr'
1>Error : Failed to generate code for FugitiveRushEditor - error code: 4
1>EXEC : error : UnrealHeaderTool failed for target 'FugitiveRushEditor' (platform: Win64, module info: C:\Users\Axel\Documents\Unreal Projects\FugitiveRush\Intermediate\Build\Win64\FugitiveRushEditor\Development\UnrealHeaderTool.manifest).
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(43,5): error MSB3073: The command ""C:\Program Files\Unreal Engine\4.1\Engine\Build\BatchFiles\Rebuild.bat" FugitiveRushEditor Win64 Development "C:\Users\Axel\Documents\Unreal Projects\FugitiveRush\FugitiveRush.uproject" -rocket" exited with code 1.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
It seems that TSubobjectPtr is defined in Runtime/CoreUObject/Public/UObject/UObjectGlobals.h
, however since it is not included in the Projectile.h template, I assume that this header file is included in either the .generated.h
file or more likely the Actor.h
file. I’ve read the manual, but it hasn’t cleared up my issue. So I guess my question is twofold:
- How can I fix this error message, and what am I doing wrong?
- Are there implicit dependencies within the first person template project files? Why does the generated file for
ProjectileBasicExplosion.h
need to includeActor.h
while the template fileProjectile.h
not? If so, what are they and where are they configured?
Thanks for the help.