#include "BullCowCartridge.h" error

I’m not sure if anyone else has had this error. I’ve tried looking for a solution online as well. It seems to be that the compiler is not locating the “BullCowCartridge.h” hear file even though it’s in the original folder. The error message suggests I update my compile_commands.json or includePath. Any help would be greatly appreciated! My code is reading back with 32 errors but I believe it’s because to the code my header file doesn’t exist. Thank you!

I don’t believe I have any errors but I’ll post my code just incase
Here is my code so far:
For File: BullCowCartridge.cpp

#include “BullCowCartridge.h”

void UBullCowCartridge::BeginPlay() // When the game starts

{

Super::BeginPlay();

SetupGame();

PrintLine(TEXT("The Hidden Word is: %s."), *HiddenWord); // Debug Line

}

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

{

if (bGameOver) 

{   

    ClearScreen();

    SetupGame();

}

else // Checking PlayerGuess

{

   if (Input == HiddenWord)

    {

        PrintLine(Input);

        PrintLine(TEXT(" is the correct answer"));

        EndGame();

    }

    else

    {

        if (Input.Len() != HiddenWord.Len())

        {

        PrintLine(TEXT("The Hidden Word is %i characters long. \nYou Lose"), HiddenWord.Len());

        EndGame();

        }

    }

}   

}

void UBullCowCartridge::SetupGame()

{

Printline(Text("Welcome to Bulls and Cows!"))



HiddenWord = TEXT("cakes");

Lives = 4;

bGameOver = false



PrintLine(TEXT("Guess the %i letter word"), HiddenWord.Len());

PrintLine(TEXT("Type in your guess! \nPress enter to continue.."));

}

void UBellCowCartridge::EndGame()

{

bGameOver = true;

PrintLine(TEXT("Press enter to play again"));

}

For File BullCowCartridge. h

#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;

void SetupGame();

void EndGame;

// Your declarations go below!

private:

FString HiddenWord;

int32 Lives;

bool bGameOver;

};

Also Currently Unreal is not compiling my code.

Here is the compiler error codes.

Downgrade the C/C++ extension to 1.2.2.

As for your compilation issue

void EndGame;

This is missing ()

Thank you Dan! I completely missed that! I’m still new to this haha

1 Like

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

Privacy & Terms