Compiling C++ code takes no effect

Hi there,

I have been having trouble for quite some time where I make some changes to my code and compile but I cannot see my changes take effect in the game even when UE says compilation completes successfully. I have tried looking through different posts and could not find a problem similar to the one I am facing.

I have tried hitting Compile multiple times as the instructor suggests but that still does not do anything. I have also re-downloaded the project from the course and set everything up again but still nothing. I have been working on VS code, however, I also generated a VS community solution and tried building from there but still nothing takes effect.

Can someone please help?

Thanks,
yousi

Compiler log below

Building BullCowGameEditor...
Using Visual Studio 2017 14.16.27040 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023) and Windows 10.0.17763.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 3 actions with 8 processes...
  [1/3] UE4Editor-BullCowGame-4260.lib
     Creating library C:\Users\yousi\Documents\Unreal Projects\BullCowGame-starter-kit\Intermediate\Build\Win64\UE4Editor\Development\BullCowGame\UE4Editor-BullCowGame-4260.lib and object C:\Users\yousi\Documents\Unreal Projects\BullCowGame-starter-kit\Intermediate\Build\Win64\UE4Editor\Development\BullCowGame\UE4Editor-BullCowGame-4260.exp
  [2/3] UE4Editor-BullCowGame-4260.dll
     Creating library C:\Users\yousi\Documents\Unreal Projects\BullCowGame-starter-kit\Intermediate\Build\Win64\UE4Editor\Development\BullCowGame\UE4Editor-BullCowGame-4260.suppressed.lib and object C:\Users\yousi\Documents\Unreal Projects\BullCowGame-starter-kit\Intermediate\Build\Win64\UE4Editor\Development\BullCowGame\UE4Editor-BullCowGame-4260.suppressed.exp
  [3/3] BullCowGameEditor.target
Total time in Parallel executor: 2.42 seconds
Total execution time: 3.50 seconds

What is your code?
What are you getting?
What are you expecting?

Hi @DanM, the following is my code:

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

void UBullCowCartridge::BeginPlay() // When the game starts
{
    Super::BeginPlay();
    PrintLine(TEXT("Hello! Welcome to BullCowGame!"));
    PrintLine(TEXT("In this game you have to guess the 4 letter hidden word!")); // TODO: do not hardcode
    PrintLine(TEXT("Type in your guess and hit 'Enter' to see if your guess is correct!"));
}

void UBullCowCartridge::OnInput(const FString& Input) // When the player hits enter
{
    ClearScreen();
    FString HiddenWord = TEXT("cake");
    if (Input == HiddenWord)
    {
        PrintLine(TEXT("Correct guess. You win!"));
    }
    else
    {
        PrintLine(TEXT("Incorrect guess. You lose!"));
    }
}

I am expecting the Bulls and Cow game to run the basic game loop I have coded above. I am not getting that. I am instead getting an empty prompt at the terminal.

Thanks,
Yousif

Are you sure you have the component attached to the actor?

The component was not attached. The code is working. Thank you. Sorry about that.

So how does that work exactly. Is the terminal coded in a way that it looks for its attached cartridge (component) and calls the functions BeginPlay() and OnInput()?

Thanks

BeginPlay is handled by the engine. OnInput is called from the Terminal component when enter is pressed.

1 Like

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

Privacy & Terms