Need help. Way Too many errors to continue coding at this point


error4|689x123

After creating and including header file HiddenWordList my whole programm isn’t working anymore. I have put my 3 files of code down below. Sometimes it shows 4000 errors and sometimes only 2 and sometimes 5. I have tried the option “rebuild project solution”, but it didn’t work and I can’t open it in unreal

My HiddenWordList.h:

#pragma once
#include "CoreMinimal.h"

const TArray<FString> Words = // here I get error saying "variable FString is not a type name"
{
	TEXT("milks"),
	TEXT("cakes"),
	TEXT("kings"),
	TEXT("plums")
};

My BullCowCartridge.h:

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

#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 InitGame();
	void EndGame();
	void ProcessGuess(FString Guess);
	bool IsIsogram(FString Word) const;

	// Your declarations go below!
	private:
	FString HiddenWord;
	int32 Lives;
	bool bGameOver;
};

My BullCowCartridge.cpp:

// Fill out your copyright notice in the Description page of Project Settings.
#include "BullCowCartridge.h"
#include "HiddenWordList.h"

void UBullCowCartridge::BeginPlay() // When the game starts. Here I get syntax error saying "void should be preceded by;"
{
    Super::BeginPlay();
    InitGame();
}

void UBullCowCartridge::OnInput(const FString& Input) // When the player hits enter
{
    if (bGameOver)
    {
        ClearScreen();
        InitGame();
        PrintLine(TEXT("Nr. of possible words: %i"), Words.Num());
    }
    else
    {
        ProcessGuess(Input);
    }
}

void UBullCowCartridge::InitGame()
{
    PrintLine(TEXT("***  WELCOME TO BULL COWS GAME!!! ***"));

    HiddenWord = TEXT("milks");
    Lives = 4;
    bGameOver = false;

    PrintLine(TEXT("Guess the %i letter woed!."), HiddenWord.Len());
    PrintLine(TEXT("Please enter..."));
}

void UBullCowCartridge::EndGame()
{
    bGameOver = true;
    PrintLine(TEXT("Press Enter to play again. Hidden word was: %s"), *HiddenWord);
}

void UBullCowCartridge::ProcessGuess(FString Guess)
{
    if (Guess == HiddenWord)
    {
        PrintLine(TEXT("You have won"));
        EndGame();
        return;
    }


    if (Guess.Len() != HiddenWord.Len())
    {
        PrintLine(TEXT("Wrong. %i lives remaining. Word lrngth is: %i"), Lives, HiddenWord.Len());
        return;
    }

    if (!IsIsogram(Guess))
    {
        PrintLine(TEXT("No repeating letters, guess again"));
        return;
    }

    --Lives;
    PrintLine(TEXT("Life Lost"));// sometimes I get error here saying "this declaration has no storage class or type specifier"

    if (Lives <= 0)
    {
        PrintLine(TEXT("Game Lost"));
        EndGame();
        return;
    }

    PrintLine(TEXT("%i Life Left"), Lives);
} // here I get an error "expected a declaration!"

bool UBullCowCartridge::IsIsogram(FString Word) const
{
    for (int32 Index = 0; Index < Word.Len(); Index++)
    {
        for (int32 Comparison = Index + 1; Comparison <= Word.Len(); Comparison++)
        {
            if (Word[Index] == Word[Comparison])
            {
                return false;
            }
        }
    }
    return true;
}

What version of Unreal and Visual Studio are you using? Have you tried File > Refresh Visual Studio Project in Unreal?

I am using Visual Studio 19 Community Edition with Unreal Engine 4.26. I don’t know how to refresh VS19 project in unreal since I can’t enter unreal. I get following messages:
error5
error6

That would mean you have a compilation error and no built binaries to fall back on (I assume because you just deleted them)

Go into Saved > Logs and then post the most recent log.

Log file open, 04/06/21 10:41:55
LogInit: LLM is enabled
LogInit: LLM CsvWriter: off TraceWriter: off
LogInit: Display: Running engine for game: BullCowGame
LogPlatformFile: Not using cached read wrapper
LogTaskGraph: Started task graph with 5 named threads and 11 total threads with 3 sets of task threads.
LogStats: Stats thread started at 1.543451
LogD3D11RHI: Loaded GFSDK_Aftermath_Lib.x64.dll
LogICUInternationalization: ICU TimeZone Detection - Raw Offset: +1:00, Platform Override: ‘’
LogPluginManager: Mounting plugin MeshPainting
LogPluginManager: Mounting plugin XGEController
LogPluginManager: Mounting plugin Paper2D
LogPluginManager: Mounting plugin AISupport
LogPluginManager: Mounting plugin LightPropagationVolume
LogPluginManager: Mounting plugin EnvironmentQueryEditor
LogPluginManager: Mounting plugin CameraShakePreviewer
LogPluginManager: Mounting plugin CLionSourceCodeAccess
LogPluginManager: Mounting plugin AnimationSharing
LogPluginManager: Mounting plugin GitSourceControl
LogPluginManager: Mounting plugin CodeLiteSourceCodeAccess
LogPluginManager: Mounting plugin NullSourceCodeAccess
LogPluginManager: Mounting plugin KDevelopSourceCodeAccess
LogPluginManager: Mounting plugin PerforceSourceControl
LogPluginManager: Mounting plugin PlasticSourceControl
LogPluginManager: Mounting plugin PluginUtils
LogPluginManager: Mounting plugin PropertyAccessNode
LogPluginManager: Mounting plugin RiderSourceCodeAccess
LogPluginManager: Mounting plugin SubversionSourceControl
LogPluginManager: Mounting plugin UObjectPlugin
LogPluginManager: Mounting plugin VisualStudioCodeSourceCodeAccess
LogPluginManager: Mounting plugin VisualStudioSourceCodeAccess
LogPluginManager: Mounting plugin AssetManagerEditor
LogPluginManager: Mounting plugin XCodeSourceCodeAccess
LogPluginManager: Mounting plugin CryptoKeys
LogPluginManager: Mounting plugin DataValidation
LogPluginManager: Mounting plugin CurveEditorTools
LogPluginManager: Mounting plugin FacialAnimation
LogPluginManager: Mounting plugin GeometryMode
LogPluginManager: Mounting plugin GameplayTagsEditor
LogPluginManager: Mounting plugin MacGraphicsSwitching
LogPluginManager: Mounting plugin MaterialAnalyzer
LogPluginManager: Mounting plugin MobileLauncherProfileWizard
LogPluginManager: Mounting plugin PluginBrowser
LogPluginManager: Mounting plugin SpeedTreeImporter
LogPluginManager: Mounting plugin DatasmithContent
LogPluginManager: Mounting plugin VariantManagerContent
LogPluginManager: Mounting plugin AlembicImporter
LogPluginManager: Mounting plugin AutomationUtils
LogPluginManager: Mounting plugin BackChannel
LogPluginManager: Mounting plugin ChaosCloth
LogPluginManager: Mounting plugin ChaosClothEditor
LogPluginManager: Mounting plugin ChaosEditor
LogPluginManager: Mounting plugin ChaosNiagara
LogPluginManager: Mounting plugin CharacterAI
LogPluginManager: Mounting plugin ChaosSolverPlugin
LogPluginManager: Mounting plugin Niagara
LogPluginManager: Mounting plugin GeometryCache
LogPluginManager: Mounting plugin LuminPlatformFeatures
LogPluginManager: Mounting plugin MagicLeap
LogPluginManager: Mounting plugin MagicLeapLightEstimation
LogPluginManager: Mounting plugin MagicLeapMedia
LogPluginManager: Mounting plugin MagicLeapPassableWorld
LogPluginManager: Mounting plugin MLSDK
LogPluginManager: Mounting plugin GeometryCollectionPlugin
LogPluginManager: Mounting plugin GeometryProcessing
LogPluginManager: Mounting plugin MotoSynth
LogPluginManager: Mounting plugin PlanarCut
LogPluginManager: Mounting plugin PlatformCrypto
LogPluginManager: Mounting plugin ProxyLODPlugin
LogPluginManager: Mounting plugin SkeletalReduction
LogPluginManager: Mounting plugin AndroidMedia
LogPluginManager: Mounting plugin AvfMedia
LogPluginManager: Mounting plugin ImgMedia
LogPluginManager: Mounting plugin MediaCompositing
LogPluginManager: Mounting plugin MediaPlayerEditor
LogPluginManager: Mounting plugin WebMMedia
LogPluginManager: Mounting plugin WmfMedia
LogPluginManager: Mounting plugin ActorSequence
LogPluginManager: Mounting plugin LevelSequenceEditor
LogPluginManager: Mounting plugin MatineeToLevelSequence
LogPluginManager: Mounting plugin TemplateSequence
LogPluginManager: Mounting plugin TcpMessaging
LogPluginManager: Mounting plugin UdpMessaging
LogPluginManager: Mounting plugin OnlineSubsystem
LogPluginManager: Mounting plugin OnlineSubsystemNull
LogPluginManager: Mounting plugin OnlineSubsystemUtils
LogPluginManager: Mounting plugin LauncherChunkInstaller
LogPluginManager: Mounting plugin ActorLayerUtilities
LogPluginManager: Mounting plugin AndroidDeviceProfileSelector
LogPluginManager: Mounting plugin AndroidPermission
LogPluginManager: Mounting plugin AndroidMoviePlayer
LogPluginManager: Mounting plugin AppleImageUtils
LogPluginManager: Mounting plugin ArchVisCharacter
LogPluginManager: Mounting plugin AppleMoviePlayer
LogPluginManager: Mounting plugin AssetTags
LogPluginManager: Mounting plugin AudioCapture
LogPluginManager: Mounting plugin AudioSynesthesia
LogPluginManager: Mounting plugin CableComponent
LogPluginManager: Mounting plugin ChunkDownloader
LogPluginManager: Mounting plugin CustomMeshComponent
LogPluginManager: Mounting plugin EditableMesh
LogPluginManager: Mounting plugin ExampleDeviceProfileSelector
LogPluginManager: Mounting plugin GooglePAD
LogPluginManager: Mounting plugin GoogleCloudMessaging
LogPluginManager: Mounting plugin IOSDeviceProfileSelector
LogPluginManager: Mounting plugin LinuxDeviceProfileSelector
LogPluginManager: Mounting plugin LocationServicesBPLibrary
LogPluginManager: Mounting plugin MobilePatchingUtils
LogPluginManager: Mounting plugin PhysXVehicles
LogPluginManager: Mounting plugin PostSplashScreen
LogPluginManager: Mounting plugin PropertyAccessEditor
LogPluginManager: Mounting plugin ProceduralMeshComponent
LogPluginManager: Mounting plugin RuntimePhysXCooking
LogPluginManager: Mounting plugin SignificanceManager
LogPluginManager: Mounting plugin SoundFields
LogPluginManager: Mounting plugin Synthesis
LogPluginManager: Mounting plugin WebMMoviePlayer
LogPluginManager: Mounting plugin WindowsMoviePlayer
LogPluginManager: Mounting plugin ScreenshotTools
LogPluginManager: Mounting plugin ContentBrowserAssetDataSource
LogPluginManager: Mounting plugin ContentBrowserClassDataSource
LogPluginManager: Mounting plugin OnlineSubsystemGooglePlay
LogPluginManager: Mounting plugin OnlineSubsystemIOS
LogPluginManager: Mounting plugin OculusVR
LogPluginManager: Mounting plugin SteamVR
LogXGEController: Cleaning working directory: C:/Users/jdrag/AppData/Local/Temp/UnrealXGEWorkingDir/
LogXGEController: Cannot use XGE Controller as Incredibuild is not installed on this machine.
LogInit: Warning: Incompatible or missing module: BullCowGame
Running C:/Program Files/UE_4.26/Engine/Binaries/DotNET/UnrealBuildTool.exe Development Win64 -Project=“D:/Programming/C++/GameDevCourse/BuildCowGame-starter-kit/BullCowGame-starter-kit/BullCowGame.uproject” -TargetType=Editor -Progress -NoEngineChanges -NoHotReloadFromIDE
@progress push 5%
@progress pop
Building BullCowGameEditor…
Using Visual Studio 2019 14.28.29913 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910) and Windows 10.0.18362.0 SDK (C:\Program Files (x86)\Windows Kits\10).
[Upgrade]
[Upgrade] Using backward-compatible build settings. The latest version of UE4 sets the following values by default, which may require code changes:
[Upgrade] bLegacyPublicIncludePaths = false => Omits subfolders from public include paths to reduce compiler command line length. (Previously: true).
[Upgrade] ShadowVariableWarningLevel = WarningLevel.Error => Treats shadowed variable warnings as errors. (Previously: WarningLevel.Warning).
[Upgrade] PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs => Set in build.cs files to enables IWYU-style PCH model. See https://docs.unrealengine.com/en-US/Programming/BuildTools/UnrealBuildTool/IWYU/index.html. (Previously: PCHUsageMode.UseSharedPCHs).
[Upgrade] Suppress this message by setting ‘DefaultBuildSettings = BuildSettingsVersion.V2;’ in BullCowGameEditor.Target.cs, and explicitly overriding settings that differ from the new defaults.
[Upgrade]
Building 4 actions with 4 processes…
@progress ‘Compiling C++ source code…’ 0%
@progress ‘Compiling C++ source code…’ 25%
[1/4] BullCowCartridge.cpp
D:\Programming\C++\GameDevCourse\BuildCowGame-starter-kit\BullCowGame-starter-kit\Source\BullCowGame\BullCowCartridge.cpp(5): error C2144: syntax error: ‘void’ should be preceded by ‘;’
LogInit: Warning: Still incompatible or missing module: BullCowGame
LogCore: Engine exit requested (reason: EngineExit() was called)
LogExit: Preparing to exit.
LogModuleManager: Shutting down and abandoning module DesktopPlatform (48)
LogModuleManager: Shutting down and abandoning module PlatformCryptoOpenSSL (46)
LogModuleManager: Shutting down and abandoning module PlatformCryptoTypes (44)
LogModuleManager: Shutting down and abandoning module PlatformCrypto (42)
LogModuleManager: Shutting down and abandoning module XGEController (40)
LogXGEController: Cleaning working directory: C:/Users/jdrag/AppData/Local/Temp/UnrealXGEWorkingDir/
LogModuleManager: Shutting down and abandoning module AnimationModifiers (38)
LogModuleManager: Shutting down and abandoning module AudioEditor (36)
LogModuleManager: Shutting down and abandoning module PropertyEditor (35)
LogModuleManager: Shutting down and abandoning module TextureCompressor (32)
LogModuleManager: Shutting down and abandoning module RenderCore (30)
LogModuleManager: Shutting down and abandoning module Landscape (28)
LogModuleManager: Shutting down and abandoning module SlateRHIRenderer (26)
LogModuleManager: Shutting down and abandoning module OpenGLDrv (24)
LogModuleManager: Shutting down and abandoning module D3D11RHI (22)
LogModuleManager: Shutting down and abandoning module AnimGraphRuntime (20)
LogModuleManager: Shutting down and abandoning module Renderer (18)
LogModuleManager: Shutting down and abandoning module Engine (16)
LogModuleManager: Shutting down and abandoning module CoreUObject (14)
LogModuleManager: Shutting down and abandoning module NetworkFile (12)
LogModuleManager: Shutting down and abandoning module CookedIterativeFile (10)
LogModuleManager: Shutting down and abandoning module StreamingFile (8)
LogModuleManager: Shutting down and abandoning module SandboxFile (6)
LogModuleManager: Shutting down and abandoning module PakFile (4)
LogModuleManager: Shutting down and abandoning module RSA (3)
LogExit: Exiting.
Log file closed, 04/06/21 10:44:05

I presume you didn’t end your Words variable with a semicolon

TArray<FString> Words = 
{
    // words
    // ...
}; // <- missing semicolon

actually I have:

What about your class definition?

class UBullCowCartridge : ...
{
}; // <

er8

I only use words here

That isn’t your class definition. The class definition is in the header file.

I didn’t put Words there

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

#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 InitGame();
	void EndGame();
	void ProcessGuess(FString Guess);
	bool IsIsogram(FString Word) const;

	// Your declarations go below!
	private:
	FString HiddenWord;
	int32 Lives;
	bool bGameOver;
};

Right, but that’s not the reason you’re getting a compilation error. The error says you’re missing a semicolon before line 5 of BullCowCartridge.cpp

Would you mind showing the start of that file?

this is my start of the file(line 5 is the start of the definition void UBullCowCartridge::BeginPlay()):

// Fill out your copyright notice in the Description page of Project Settings.
#include "BullCowCartridge.h"
#include "HiddenWordList.h"

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

void UBullCowCartridge::OnInput(const FString& Input) // When the player hits enter
{
    if (bGameOver)
    {
        ClearScreen();
        InitGame();
        PrintLine(TEXT("Nr. of possible words: %i"), Words.Num());
    }
    else
    {
        ProcessGuess(Input);
    }
}

Is that log the most recent? i.e. the one without “backup” in its name?

yes

Then that’s a bit confusing since I’m not seeing any missing semicolons.

However the fact that you’re getting an underline for FString in this screenshot

Makes me think you saved the HiddenWordList.h somewhere else. Could you hover over the tab so it shows the path?

image

It should be under “Source” and if you didn’t change the path when creating the file it’s most likely under “Intermediate”. It needs to be in the same location as BullCowCartridge.cpp (in Source).

it saved it for some reason in D:\Programming\C++\GameDevCourse\BuildCowGame-starter-kit\BullCowGame-starter-kit\Intermediate\ProjectFiles

Yeah, VS Community will default to that path for Unreal projects, most likely due to the generated files that are created. There should be a note about this in the course.

he mentioned that vs will default save it somewhere else then its supposed to, but I wasn’t prompted to set the location to which I want it to be saved, so I just hoped for the best. Is there any way I can fix this

Just move the file in File Explorer.

Privacy & Terms