I ran into this error at 19:34 after attempting to compile

Building BullCowGameEditor…
Using Visual Studio 2019 14.29.30038 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037) and Windows 10.0.16299.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 8 processes…
[1/4] BullCowCartridge.cpp
C:\Users\Shadow\Desktop\BullCowGame-starter-kit\BullCowGame-starter-kit\Source\BullCowGame\BullCowCartridge.cpp(60) : error C4390: ‘;’: empty controlled statement found; is this the intent?
C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h(1552) : error C2338: Invalid argument(s) passed to FString::Printf
C:\Users\Shadow\Desktop\BullCowGame-starter-kit\BullCowGame-starter-kit\Source\BullCowGame\Console/Cartridge.h(24): note: see reference to function template instantiation ‘FString FString::Printf<TCHAR[24],FString>(const FmtType (&),FString)’ being compiled
with
[
FmtType=TCHAR [24]
]
C:\Users\Shadow\Desktop\BullCowGame-starter-kit\BullCowGame-starter-kit\Source\BullCowGame\BullCowCartridge.cpp(80): note: see reference to function template instantiation ‘void UCartridge::PrintLine<24,FString>(const TCHAR (&)[24],FString) const’ being compiled
C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h(1554) : error C4840: non-portable use of class ‘FString’ as an argument to a variadic function
C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h(1554): note: ‘FString::FString’ is non-trivial
C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h(190): note: see declaration of ‘FString::FString’
C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h(1554): note: the constructor and destructor will not be called; a bitwise copy of the class will be passed as the argument
C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Windows/WindowsCriticalSection.h(9): note: see declaration of ‘FString’
Here’s 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(); 
    
    InitGame(); // Setting up Game
   
    PrintLine(TEXT("The HiddenWord is: %s."), *HiddenWord); //Debug Line
    // Prompt player for guess
}

void UBullCowCartridge::OnInput(const FString& Input) // When the player hits enter
{
if (bGameOver)
    {
    ClearScreen();
    InitGame();
}
else
{
    ProcessGuess(Input);
}


 }

 void UBullCowCartridge::InitGame()
 {
        // Welcome To Game
    PrintLine(TEXT("Welcome To Bull Cows!"));
    
    HiddenWord = TEXT("poofs");
    Lives = HiddenWord.Len();
    bGameOver = false;
    
    PrintLine(TEXT("Guess the %i letter word!"), HiddenWord.Len()); 
    PrintLine(TEXT("You have %i lives"), Lives);
    PrintLine(TEXT("Type in your guess and press enter to continue..."));

 }
 void UBullCowCartridge::EndGame()
 {
        bGameOver = true;
        PrintLine(TEXT("\nPress enter to play again"));
     
 }
 
 void UBullCowCartridge::ProcessGuess(FString Guess)
 {
    if (Guess == HiddenWord)
    {
    PrintLine(TEXT("You have won.."));
    EndGame();
    return;
    }
 
// Check if Isogram
if (!bIsIsogram(Guess));
    {
        PrintLine(TEXT("You haven't entered an isogram"));
        PrintLine(TEXT("Remember, no repeating letters."));
        return;
    }
if (Guess.Len() != HiddenWord.Len())
{
    PrintLine(TEXT("Sorry, try guessing again! \nYou have %i lives remaining"), Lives);
    PrintLine(TEXT("The hidden word is %i letter long"), HiddenWord.Len());
    return;
}
// Remove Life
 PrintLine(TEXT("Lost a life"));
--Lives;

if(Lives <= 0)
    { 
        ClearScreen();
        PrintLine(TEXT("You have no lives left!"));
        PrintLine(TEXT("The hidden word was: %s"), HiddenWord);
        EndGame();
        return;
    }
 }
// Show the player bulls and Cows
bool UBullCowCartridge::bIsIsogram(FString Word)
{
     // For each letter
    // Start at element [0].
    // Compare against next letter
    // Until we reach[Word.Len() -1].
    // if its the same Word retrun false

    return true;
}   

Hi,

your log is reporting an error at line 60

In your code there is a ; after the condition of the if statement

if (!bIsIsogram(Guess));
    {
        PrintLine(TEXT("You haven't entered an isogram"));
        PrintLine(TEXT("Remember, no repeating letters."));
        return;
    }
2 Likes

Hi, sorry for the really late response, now I have these errors. Help would be really appreciated.
Sorry again, I’m very new to coding, I honestly don’t know what I’m doing.

Building 4 actions with 8 processes...
  [1/4] BullCowCartridge.cpp
   C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h(1552) : error C2338: Invalid argument(s) passed to FString::Printf
  C:\Users\Shadow\Desktop\BullCowGame-starter-kit\BullCowGame-starter-kit\Source\BullCowGame\Console/Cartridge.h(24): note: see reference to function template instantiation 'FString FString::Printf<TCHAR[22],FString>(const FmtType (&),FString)' being compiled
          with
          [
              FmtType=TCHAR [22]
          ]
  C:\Users\Shadow\Desktop\BullCowGame-starter-kit\BullCowGame-starter-kit\Source\BullCowGame\BullCowCartridge.cpp(80): note: see reference to function template instantiation 'void UCartridge::PrintLine<22,FString>(const TCHAR (&)[22],FString) const' being compiled
   C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h(1554) : error C4840: non-portable use of class 'FString' as an argument to a variadic function
  C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h(1554): note: 'FString::FString' is non-trivial
  C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h(190): note: see declaration of 'FString::FString'
  C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h(1554): note: the constructor and destructor will not be called; a bitwise copy of the class will be passed as the argument
  C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Windows/WindowsCriticalSection.h(9): note: see declaration of 'FString'

To find error in the log try to find when possible your file name you are working on and the line number between parentheses.

1 Like

You are missing a * when trying to format an FString

1 Like

BullCowCartridge.ccp isn’t reporting any errors on vscode (Except for line 81),
I’ve been trying to figure out what’s wrong for like an hour now. It still won’t compile on unreal.
I honestly don’t know what any of this stuff means. ↓
Thanks for the help so far guys.

Building BullCowGameEditor...
Using Visual Studio 2019 14.29.30133 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133) and Windows 10.0.16299.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 8 processes...
  [1/4] BullCowCartridge.cpp
   C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h(1552) : error C2338: Invalid argument(s) passed to FString::Printf
  C:\Users\Shadow\Desktop\BullCowGame-starter-kit\BullCowGame-starter-kit\Source\BullCowGame\Console/Cartridge.h(24): note: see reference to function template instantiation 'FString FString::Printf<TCHAR[24],FString>(const FmtType (&),FString)' being compiled
          with
          [
              FmtType=TCHAR [24]
          ]
  C:\Users\Shadow\Desktop\BullCowGame-starter-kit\BullCowGame-starter-kit\Source\BullCowGame\BullCowCartridge.cpp(81): note: see reference to function template instantiation 'void UCartridge::PrintLine<24,FString>(const TCHAR (&)[24],FString) const' being compiled
   C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h(1554) : error C4840: non-portable use of class 'FString' as an argument to a variadic function
  C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h(1554): note: 'FString::FString' is non-trivial
  C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h(190): note: see declaration of 'FString::FString'
  C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Containers/UnrealString.h(1554): note: the constructor and destructor will not be called; a bitwise copy of the class will be passed as the argument
  C:\Program Files\Epic Games\UE_4.26\Engine\Source\Runtime\Core\Public\Windows/WindowsCriticalSection.h(9): note: see declaration of 'FString'

That says your error is on line 81 in BullCowCartridge. Which is likely to be the error I pointed out.

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

Privacy & Terms