This is very frustrating to see I am unable to compile the code which I copied from the tutorials bit by bit. I understand that there are some changes due to the version differences…The video turtorial shows the Pickup.cpp has the class constructor code generated already but here its just empty except the #includes. I manually copied the code from the source code provided but I get errors shown below.
I saw some notes in the wiki saying this has changed in 4.4 which talks only about the GENERATED_BODY() macros, there is something about constructor also mentioned which I have tried by replacing the constructor signature but I get the same errors I have no idea what to do can someone please help me.
Pickup.h:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/Actor.h"
#include "Pickup.generated.h"
/**
*
*/
UCLASS()
class APickup : public AActor
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Pickup)
bool bIsActive;
UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = Pickup)
TSubobjectPtr<USphereComponent> BaseCollisionComponent;
UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = Pickup)
TSubobjectPtr<UStaticMeshComponent> PickupMesh;
UFUNCTION(BlueprintNativeEvent)
void OnPickedUp();
};
Pickup.cpp:
// Fill out your copyright notice in the Description page of Project Settings.
#include "TPS1.h"
#include "Pickup.h"
APickup::APickup(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
// The pickup is valid when it is created.
bIsActive = true;
// Create the root SphereComponent to handle the pickup's collision
BaseCollisionComponent = PCIP.CreateDefaultSubobject<USphereComponent>(this, TEXT("BaseSphereComponent"));
// Set the SphereComponent as the root component.
RootComponent = BaseCollisionComponent;
// Create the StaticMeshComponent.
PickupMesh = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("PickupMesh"));
// Turn physics on for the static mesh.
PickupMesh->SetSimulatePhysics(true);
// Attach the StaticMeshComponent to the RootComponent.
PickupMesh->AttachTo(RootComponent);
}
void APickup::OnPickedUp_Implementation()
{
// There is no default behavior for a Pickup when it is picked up.
}
Warnings & Errors:
Warning 1 warning C4996: TSubobjectPtr is deprecated and should no longer be used. Please use pointers instead. c:\users\me\documents\unreal projects\tps1\source\tps1\private\Pickup.h 20 1 TPS1
Warning 2 warning C4996: TSubobjectPtr is deprecated and should no longer be used. Please use pointers instead. c:\users\me\documents\unreal projects\tps1\source\tps1\private\Pickup.h 23 1 TPS1
Warning 3 warning C4996: TSubobjectPtr is deprecated and should no longer be used. Please use pointers instead. C:\users\me\Documents\Unreal Projects\TPS1\Source\TPS1\Private\Pickup.h 20 1 TPS1
Warning 4 warning C4996: TSubobjectPtr is deprecated and should no longer be used. Please use pointers instead. C:\users\me\Documents\Unreal Projects\TPS1\Source\TPS1\Private\Pickup.h 23 1 TPS1
Warning 5 warning C4996: FPostConstructInitializeProperties is deprecated and was renamed to FObjectInitializer. Please use that type instead. C:\users\me\Documents\Unreal Projects\TPS1\Source\TPS1\Private\Pickup.cpp 7 1 TPS1
Error 6 error C2084: function 'APickup::APickup(const FObjectInitializer &)' already has a body C:\users\me\Documents\Unreal Projects\TPS1\Source\TPS1\Private\Pickup.cpp 8 1 TPS1
Error 7 error : Failed to produce item: C:\users\me\Documents\Unreal Projects\TPS1\Binaries\Win64\UE4Editor-TPS1.dll C:\users\me\Documents\Unreal Projects\TPS1\Intermediate\ProjectFiles\ERROR TPS1
Error 8 error MSB3073: The command "C:\Git\UnrealEngine\Engine\Build\BatchFiles\Build.bat TPS1Editor Win64 Development "C:\users\me\Documents\Unreal Projects\TPS1\TPS1.uproject"" exited with code -1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets 38 5 TPS1
9 IntelliSense: identifier "FGuid" is undefined c:\Git\UnrealEngine\Engine\Source\Runtime\Core\Public\Serialization\ArchiveBase.h 561 26 TPS1
10 IntelliSense: identifier "FGuid" is undefined c:\Git\UnrealEngine\Engine\Source\Runtime\Core\Public\Serialization\ArchiveBase.h 569 18 TPS1
11 IntelliSense: identifier "FGuid" is undefined c:\Git\UnrealEngine\Engine\Source\Runtime\Core\Public\Serialization\ArchiveBase.h 770 24 TPS1
12 IntelliSense: identifier "FOnSelectedLevelsChangedEvent" is undefined c:\Git\UnrealEngine\Engine\Source\Runtime\Engine\Classes\Engine\World.h 1976 2 TPS1
13 IntelliSense: identifier "UParticleModuleEventSendToGame" is undefined c:\Git\UnrealEngine\Engine\Source\Runtime\Engine\Classes\Particles\ParticleSystemComponent.h 890 68 TPS1
14 IntelliSense: identifier "UParticleModuleEventSendToGame" is undefined c:\Git\UnrealEngine\Engine\Source\Runtime\Engine\Classes\Particles\ParticleSystemComponent.h 903 68 TPS1
15 IntelliSense: identifier "UParticleModuleEventSendToGame" is undefined c:\Git\UnrealEngine\Engine\Source\Runtime\Engine\Classes\Particles\ParticleSystemComponent.h 921 69 TPS1
16 IntelliSense: identifier "UParticleModuleEventSendToGame" is undefined c:\Git\UnrealEngine\Engine\Source\Runtime\Engine\Classes\Particles\ParticleSystemComponent.h 933 42 TPS1
17 IntelliSense: no instance of constructor "FReadSurfaceDataFlags::FReadSurfaceDataFlags" matches the argument list c:\Git\UnrealEngine\Engine\Source\Runtime\Engine\Public\UnrealClient.h 57 92 TPS1
18 IntelliSense: no instance of constructor "FReadSurfaceDataFlags::FReadSurfaceDataFlags" matches the argument list c:\Git\UnrealEngine\Engine\Source\Runtime\Engine\Public\UnrealClient.h 65 87 TPS1
19 IntelliSense: identifier "FMeshBatchElement" is undefined c:\Git\UnrealEngine\Engine\Source\Runtime\ShaderCore\Public\VertexFactory.h 488 131 TPS1
20 IntelliSense: class "APickup" has no member "OnPickedUp_Implementation" c:\users\me\Documents\Unreal Projects\TPS1\Source\TPS1\Private\Pickup.cpp 29 15 TPS1