#pragma once
#include "CoreMinimal.h"
#include "Console/Cartridge.h"
#include "BullCowCartridge.generated.h"
#include <string>
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;
};
GENERATED_BODY() has a squiggly line, and the error says
“this declaration has no storage class or type specifierC/C++(77)”
Here’s the main code.
#include "BullCowCartridge.h"
#include <string>
void UBullCowCartridge::BeginPlay() // When the game starts
{
Super::BeginPlay();
PrintLine(TEXT("Hello There!!!"));
PrintLine(TEXT("Welcome to the BullCow Game."));
PrintLine(TEXT("Guess an 10 letter Isogram."));
PrintLine(TEXT("Type Your answer and Press Enter."));
FString HiddenWord = TEXT("Journalist");
}
void UBullCowCartridge::OnInput(const FString& Input) // When the player hits enter
{
if(Input==HiddenWord)
{
PrintLine(TEXT("You Win"));
}
else
{
PrintLine(TEXT("You Lose"));
}
}
Edit: I figured it out, it seems headers shouldn’t be used after the .h headers(whatever they are). I changed the code. Error: #include found after .generated.h file
#include <string>
#include "CoreMinimal.h"
#include "Console/Cartridge.h"
#include "BullCowCartridge.generated.h"