Several strange errors trying to compile toon tanks with UE 5

In VS 2022 I get these errors:

Severity Code Description Project File Line Suppression State
Error (active) E0020 identifier IImageWrapperModule is undefined ToonTanks C:\Program Files\Epic Games\UE_5.0\Engine\Source\Runtime\Engine\Classes\Engine\Texture.h 490
Severity Code Description Project File Line Suppression State
Error (active) E0070 incomplete type is not allowed ToonTanks C:\Program Files\Epic Games\UE_5.0\Engine\Source\Runtime\SlateCore\Public\Layout\BasicLayoutWidgetSlot.h 37

I tried Rider and

Projectile.gen.cpp(26): [C4430] missing type specifier - int assumed. Note: C++ does not support default-int
Projectile.gen.cpp(26): [C2146] syntax error: missing ‘;’ before identifier ‘UClass’
Projectile.gen.cpp(239): [C2065] ‘Z_Construct_UClass_UMatineeCameraShake_NoRegister’: undeclared identifier
SubclassOf.h(99): [C2027] use of undefined type ‘UMatineeCameraShake’

What are these means ?

Could you show your Projectile.h file?

1 Like
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "GameFramework/ProjectileMovementComponent.h"
#include "Projectile.generated.h"

UCLASS()
class TOONTANKS_API AProjectile : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	AProjectile();

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

private:

	UPROPERTY(EditAnywhere)
	float Damage = 50.f;
	
	UPROPERTY(EditDefaultsOnly, Category="Projectiles")
	UStaticMeshComponent* ProjectileMesh;

	UPROPERTY(VisibleAnywhere)
	UProjectileMovementComponent* ProjectileMove;

	UFUNCTION()
	void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);

	UPROPERTY(EditAnywhere, Category="Combat")
	UParticleSystem* HitParticle;

	UPROPERTY(VisibleAnywhere, Category="Combat")
	UParticleSystemComponent* TrailParticles;

	UPROPERTY(EditAnywhere, Category="combat")
	USoundBase* LaunchSound;

	UPROPERTY(EditAnywhere, Category="combat")
	USoundBase* HitSound;

	UPROPERTY(EditAnywhere, Category="combat")
	TSubclassOf<class UMatineeCameraShake> HitCameraShakeClass; 

	

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

};

I read this is a problem for hot reload with live edit in UE5 ? but I have no longer a copy of the UE4 version and I dont not know how to disable it

I have had this same error in other projects. Go to your project directory find and delete: Binaries, DerivedDataCache, Intermediate, and Saved. Then delete your [projectname].sln file, right click your .uproject file and regenerate project files. Open your [projectname].sln file and compile your project. If you’re on Windows 11; select your .uproject file and hit Shift-f10 you will see the option to regenrate projects files.

Be careful to only delete the folders I specified.

This fixed my issue. when I upgraded a project from UE4 to UE5.

1 Like

Doesn’t appear to be anything wrong with that. The code that has the error is from generated code that that header is responsible for making. Could you try deleting the Intermediate folders and then right click your .uproject and regenerate the project files and rebuild?

1 Like

Tried now both methods @Phillip_Wood and @DanM and I still get same error. I also tried creating new UE5 project from scratch and I moved the content folder from UE4 to the new one and still also same errors !!

Here are the last lines of errors:

Severity Code Description Project File Line Suppression State
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ToonTanks C:\Users\myuser\Documents\Unreal Projects\ToonTanks\Intermediate\Build\Win64\UnrealEditor\Inc\ToonTanks\Projectile.gen.cpp 26
Error C2146 syntax error: missing ‘;’ before identifier ‘UClass’ ToonTanks C:\Users\myuser\Documents\Unreal Projects\ToonTanks\Intermediate\Build\Win64\UnrealEditor\Inc\ToonTanks\Projectile.gen.cpp 26
Error C2065 ‘Z_Construct_UClass_UMatineeCameraShake_NoRegister’: undeclared identifier ToonTanks C:\Users\myuser\Documents\Unreal Projects\ToonTanks\Intermediate\Build\Win64\UnrealEditor\Inc\ToonTanks\Projectile.gen.cpp 239
Error C2664 ‘void APlayerController::ClientStartCameraShake(TSubclassOf,float,ECameraShakePlaySpace,FRotator)’: cannot convert argument 1 from ‘TSubclassOf’ to ‘TSubclassOf’ ToonTanks C:\Users\myuser\Documents\Unreal Projects\ToonTanks\Source\ToonTanks\Projectile.cpp 60
Error MSB3073 The command C:\Program Files\Epic Games\UE_5.0\Engine\Build\BatchFiles\Build.bat ToonTanksEditor Win64 DebugGame -Project=C:\Users\myuser\Documents\Unreal Projects\ToonTanks\ToonTanks.uproject -WaitMutex -FromMsBuild exited with code 6. ToonTanks C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets 44

can you post the projectile.cpp file. The problem is around line 60. It appears it doesn’t like the way ClientStartCameraShake is being passed your CameraShakeClass.

1 Like

Yes I see now an error but I dont know what it means

File code:

// Fill out your copyright notice in the Description page of Project Settings.


#include "Projectile.h"

#include "Kismet/GameplayStatics.h"
#include "Particles/ParticleSystemComponent.h"

// Sets default values
AProjectile::AProjectile()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = false;

	ProjectileMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Projectile Mesh"));
	RootComponent = ProjectileMesh;

	ProjectileMove = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("Projectile Movement"));
	ProjectileMove->MaxSpeed = 1200.f;
	ProjectileMove->InitialSpeed = 300.f;

	TrailParticles = CreateDefaultSubobject<UParticleSystemComponent>(TEXT("Smoke Trail"));
	TrailParticles->SetupAttachment(RootComponent);

}

// Called when the game starts or when spawned
void AProjectile::BeginPlay()
{
	Super::BeginPlay();

	ProjectileMesh->OnComponentHit.AddDynamic(this, &AProjectile::OnHit);
}

void AProjectile::OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp,
	FVector NormalImpulse, const FHitResult& Hit)
{
	//UE_LOG(LogTemp, Warning, TEXT("HitComp = %s, other actor = %s, other comp = %s"), *HitComp->GetName(), *OtherActor->GetName(), *OtherComp->GetName());
	auto MyOwner = GetOwner();

	if (!MyOwner)
	{
		Destroy();
		return;
	}

	auto MyOwnerInstigator = MyOwner->GetInstigatorController();
	auto DamageTypeClass = UDamageType::StaticClass();

	if (OtherActor && OtherActor != this && OtherActor != MyOwner)
	{
		UGameplayStatics::ApplyDamage(OtherActor, Damage, MyOwnerInstigator, this, DamageTypeClass);
		if (HitParticle)
		{
			UGameplayStatics::SpawnEmitterAtLocation(this, HitParticle, GetActorLocation(), GetActorRotation());	
		}

		if (HitCameraShakeClass)
		{
			GetWorld()->GetFirstPlayerController()->ClientStartCameraShake(HitCameraShakeClass);
		}
		
	}
	Destroy();
	
}

// Called every frame
void AProjectile::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

	//ProjectileMesh->SetWorldRotation(FRotator(0.f, 0, this->GetActorRotation().Roll+5));
}


You have not included the header file for your UMatineeCameraShake

1 Like

I added now the header like in this doc
#include "MatineeCameraShake.h"

But I get error
|Error (active)|E1696|cannot open source file MatineeCameraShake.h|ToonTanks|C:\Users\myuser\Documents\Unreal Projects\ToonTanks\Source\ToonTanks\Projectile.cpp|8||

Ok I found your problem. You have not included the GameplayCameras Module in your build.cs file

one sec ill get you instructions on what to do.

1 Like

Ok find you ToonTanks.build.cs

add the GameplayCameras Module as i did.

PublicDependencyModuleNames.AddRange(new string { “GameplayCameras”, “Core”, “CoreUObject”, “Engine”, “InputCore” });

now you should be able to access the class from inside your module.
but you’re going to have a warning. to fix the warning open up your toontanks.uproject file inside a text editor. Within the pulguins section add.

"Name": "GameplayCameras",
"Enabled": true

should look like:

"Plugins": [
	{
		"Name": "GameplayCameras",
		"Enabled": true
	}
]
1 Like

Many thanks @Phillip_Wood adding this line

PublicDependencyModuleNames.AddRange(new string[] { "GameplayCameras", "Core", "CoreUObject", "Engine", "InputCore" });

fixed the problem without any warnings, in fact adding the plugins section result in previous error.

{
	"FileVersion": 3,
	"EngineAssociation": "5.0",
	"Category": "",
	"Description": "",
	"Modules": [
		{
			"Name": "ToonTanks",
			"Type": "Runtime",
			"LoadingPhase": "Default",
			"AdditionalDependencies": [
				"Engine"
			]
		}
	]
	
	
}

I wonder why we have to add this module manually ?

And last question I should use build toonTanks or build solution ?

Modules are awesome think of them as a way to implement systems that you can cherry pick into other projects if done correctly. They also will not allow your code to compile with a circler dependency. Also if your code is built into modules it speeds up compile times cause the build tool scans the modules for changes if the module has no changes then it will not mess with that module. I might be wrong on that but that is my grossly over simplified understanding of that bit lol.

And either build solution or ToonTanks I believe i’m not sure. I just always use Crtl-F5 but I use rider. If I had to go back to Visual Studio I would quit Unreal.

The syntax is weird and spaced out for the .uproject file it should look something like this if done correctly:

{
“FileVersion”: 3,
“EngineAssociation”: “{E4FE0B78-4727-47B8-F089-44A752E0386C}”,
“Category”: “”,
“Description”: “”,
“Modules”: [
{
“Name”: “PuzzlePlatforms”,
“Type”: “Runtime”,
“LoadingPhase”: “Default”,
“AdditionalDependencies”: [
“Engine”
]
},
{
“Name”: “MenuSystem”,
“Type”: “Runtime”,
“LoadingPhase”: “Default”,
“AdditionalDependencies”: [
“UMG”
]
}
],
“Plugins”: [
{
“Name”: “ModelingToolsEditorMode”,
“Enabled”: true,
“TargetAllowList”: [
“Editor”
]
},
{
“Name”: “Bridge”,
“Enabled”: true,
“SupportedTargetPlatforms”: [
“Win64”,
“Mac”,
“Linux”
]
},
{
“Name”: “OnlineSubsystemSteam”,
“Enabled”: true
},
{
“Name”: “OnlineSubsystem”,
“Enabled”: true
}
]
}

1 Like

I dont know why this look like this. and I agree rider has no alternative , I used to write code and rider add the correct header include file. But how you knew that module is missing ? I dont understand why not included automatically .

Honestly, I knew that from experience. You just got to keep at it. I didn’t pick up on it that fast because the errors was different from what you get from a none plugin module. Think of a module as a big header file with a bunch of code that is meant to handle a system for example abilities. In order to access the code you have written in your abilities Module you first need to include it inside other modules. If you enable a plugin in the engine just know you must include the module in your build.cs file.

Rider will not auto include modules for you. I actually turned auto include header files off, cause it kept adding Includes to files I didn’t need and would cause build errors.

1 Like

Thanks alot @Phillip_Wood

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms