Unreal crashes when compiling and changing the FString

Hello everyone,

I’m trying to figure out this problem but cannot find the answer.

After putting the FString HiddenWord; inside the header and initializing it in the cpp file with HiddenWord = TEXT(“cake”); , I have a crash that occurs every single time during compilation.
I’ve tested the same approche but with an int32 and there was no problem at all.

I’m a bit confused, if anyone have an idea where that might come from would be appreciated a lot.

I’m running Unreal 4.22.3

2 Likes

Can you please share your code?

Absoludly

Head :

#pragma once

#include "CoreMinimal.h"
#include "Console/Cartridge.h"
#include "BullCowCartridge.generated.h"

UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class BULLCOWGAME_API UBullCowCartridge : public UCartridge
{
	GENERATED_BODY()

	public:
	virtual void BeginPlay() override;
	virtual void OnInput(const FString& Input) override;
	// Your declarations go below!
	private:
	FString HiddenWord;
};

CPP File

#include "BullCowCartridge.h"

void UBullCowCartridge::BeginPlay() // When the game starts
{
    Super::BeginPlay();

    HiddenWord = TEXT("test");
}

void UBullCowCartridge::OnInput(const FString& Input) // When the player hits enter
{
    return;
}

Again, if I change the FString variable to a int32 variable + set a int value instead of a text value, it works! I believe I do something wrong with the FString variable

No idea if this is helpful, but CoreMinimal should include the FString type. Maybe try #include “Containers/UnrealString.h” to see if that might be it. Although if it’s an outright crash during compile no idea. I’d say look at the logs and see if there are any other clues. https://www.ue4community.wiki/Legacy/Locating_Project_Logs

What’s the crash log?

I am having the same problem, here is a ss

Close Unreal and delete your Binaries and Intermediate folders then reopen your project rebuilding when prompted.

3 Likes

Thank you Dan! That worked perfectly :smiley:

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

Privacy & Terms