[Bug] UE4 C++ Tutorials [v4.3.1]

Branch: Binary

Build Version: 4.3.1

Description: While following along with the C++Tutorials on the UnrealEngine YouTube Channel, I get some strange errors, two of which are about my Pickup.cpp but the others are engine files that I have not edited at all. I have added my code below as well as the errors I am receiving.

Pickup.cpp

#include "TutorialCode.h"
#include "Pickup.h"


APickup::APickup(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{
	//The pickup is valid when created
	bISActive = true;

		// Create the sphere componenet to handle the pickups collision
		BaseCollisionComponent = PCIP.CreateDefaultSubobject<USphereComponent>(this, TEXT("BaseSphereComponent"));

	//Set the SphereComponent as the root component
	RootComponent = BaseCollisionComponent;

	//Create the static mesh component
	PickupMesh = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("PickupMesh"));

	//Turn Physics On

	PickupMesh->SetSimulatePhysics(true);

	//Attach the static mesh to the root component

	PickupMesh->AttachTo(RootComponent);



}


void APickup::OnPickedUp_Implementation()
{
	//There is no Default Behavior
}

Pickup.h

#pragma once

#include "GameFramework/Actor.h"
#include "Pickup.generated.h"

/**
 * 
 */
UCLASS()
class TUTORIALCODE_API APickup : public AActor
{
	GENERATED_UCLASS_BODY()

		/** True when the pickup is able to be picked up, flase if something deactivates it. */
		UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Pickup)
		bool bISActive;

	//Simple Collision Primitive to use as the root component
	UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = Pickup)
		TSubobjectPtr<USphereComponent> BaseCollisionComponent;

	//StaticMeshComponent to represent the pickup in the level
	UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly, Category = Pickup)
		TSubobjectPtr<UStaticMeshComponent> PickupMesh;

	//Sets behavior for when the player picks up object
	UFUNCTION(BlueprintNativeEvent)
	void onPickup();


	
	
};

ERROR LIST:

Error 1 error C2039: ‘OnPickedUp_Implementation’ : is not a member of ‘APickup’ C:\Users\Documents\Unreal Projects\TutorialCode\Source\TutorialCode\Private\Pickup.cpp 35 1 TutorialCode

Error 2 error C2039: ‘bIsActive’ : is not a member of ‘APickup’ C:\Users\Documents\Unreal Projects\TutorialCode\Intermediate\Build\Win64\Inc\TutorialCode\TutorialCode.generated.cpp 83 1 TutorialCode

Error 3 error : Failed to produce item: C:\Users\Documents\Unreal Projects\TutorialCode\Binaries\Win64\UE4Editor-TutorialCode-Win64-DebugGame.pdb C:\Users\Documents\Unreal Projects\TutorialCode\Intermediate\ProjectFiles\ERROR TutorialCode

Error 4 error MSB3073: The command ““C:\Program Files\UnrealEngine\Unreal Engine\4.3\Engine\Build\BatchFiles\Build.bat” TutorialCodeEditor Win64 DebugGame “C:\Users\Documents\Unreal Projects\TutorialCode\TutorialCode.uproject” -rocket” exited with code -1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets 38 5 TutorialCode

Error 5 IntelliSense: identifier “FWindSourceSceneProxy” is undefined c:\Program Files\UnrealEngine\Unreal Engine\4.3\Engine\Source\Runtime\Engine\Classes\Components\WindDirectionalSourceComponent.h 20 2 TutorialCode

Error 6 IntelliSense: identifier “FOnSelectedLevelsChangedEvent” is undefined c:\Program Files\UnrealEngine\Unreal Engine\4.3\Engine\Source\Runtime\Engine\Classes\Engine\World.h 1899 2 TutorialCode

Error 7 IntelliSense: identifier “FMeshBatchElement” is undefined c:\Program Files\UnrealEngine\Unreal Engine\4.3\Engine\Source\Runtime\ShaderCore\Public\VertexFactory.h 475 131 TutorialCode

Error 8 IntelliSense: class “APickup” has no member “OnPickedUp_Implementation” c:\Users\Documents\Unreal Projects\TutorialCode\Source\TutorialCode\Private\Pickup.cpp 35 15 TutorialCode

Thanks for your help :slight_smile:

Related Forum Post: Help with UE4 C++ Tutorials - C++ - Epic Developer Community Forums

OnPickedUp_Implementation should be for a function called OnPickedUp, but it looks like your function is called onPickup, so try onPickup_Implementation instead.

I’d also recommend renaming bISActive to bIsActive to avoid any potential issues with UHT and FName case. May I use "PlayerID" as my ustruct member variable name? - Editor Scripting - Epic Developer Community Forums

You can ignore the intellisense “errors” (they’re not errors). Intellisense is really easy to confuse, so I wouldn’t put too much faith in it. The only errors you need to care about are ones generated by the compiler.

Thanks for the help. With that I was able to figure out what happened.

onPickup like you said had a lowercase ‘O’ but the implemented line was “OnPickedup” changing that eliminated that particular error.

The bISActive error was indeed just me naming it wrong. it should have been bIsActive (my shift key must have stuck) in short it was user error lol

Again thank you very much, you were a big help :slight_smile: