Download

Using a Sub Class in C++

Hey! I tried to make a sub class for my “Weapon” class, but just ended up with a bunch of compilation errors (without even altering the code that was initialized by UE4). Anyone know what the problem is?
Errors:
error C2146: syntax error : missing ‘;’ before identifier ‘Super’
error C2504: ‘AWeapon’ : base class undefined
error C2614: ‘ASubMachineGun’ : illegal member initialization: ‘Super’ is not a base or member

.h File:



UCLASS(Abstract, Blueprintable)
class ASubMachineGun : public AWeapon
{
	GENERATED_UCLASS_BODY()
};

.cpp File:



ASubMachineGun::ASubMachineGun(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{

}

Alright so I found out what the problem was immediatly after posting this (as usual :wink: )

I did not include the header for the base class (so #include “Weapon.h”).