When ever I use the C++ compiler in UE4 I get a “Compile Failed”. This shows up in the log.
Using 'git status' to determine working set for adaptive non-unity build (C:\Users\CMeye\Documents\puzzlegame).
Creating makefile for PuzzleGameEditor (ini files are newer than makefile)
Parsing headers for PuzzleGameEditor
Running UnrealHeaderTool "C:\Users\CMeye\Documents\puzzlegame\PuzzleGame\PuzzleGame.uproject" "C:\Users\CMeye\Documents\puzzlegame\PuzzleGame\Intermediate\Build\Win64\PuzzleGameEditor\Development\PuzzleGameEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
Reflection code generated for PuzzleGameEditor in 9.1834073 seconds
Using Visual Studio 2017 14.16.27023 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023) and Windows 10.0.17763.0 SDK (C:\Program Files (x86)\Windows Kits\10).
Building 4 actions with 8 processes...
[1/4] PosistionReport.cpp
d:\epic\ue_4.22\engine\source\runtime\core\public\Logging/LogMacros.h(58) : error C2338: Invalid argument(s) passed to FMsg::Logf_Internal
C:\Users\CMeye\Documents\puzzlegame\PuzzleGame\Source\PuzzleGame\PosistionReport.cpp(26): note: see reference to function template instantiation 'void FMsg::Logf_Internal(const ANSICHAR *,int32,const FName &,ELogVerbosity::Type,const FmtType (&),const TCHAR *,FString)' being compiled
with
[
FmtType=wchar_t [12]
]
d:\epic\ue_4.22\engine\source\runtime\core\public\Logging/LogMacros.h(60) : error C4840: non-portable use of class 'FString' as an argument to a variadic function
d:\epic\ue_4.22\engine\source\runtime\core\public\Logging/LogMacros.h(60): note: 'FString::FString' is non-trivial
d:\epic\ue_4.22\engine\source\runtime\core\public\Containers/UnrealString.h(73): note: see declaration of 'FString::FString'
d:\epic\ue_4.22\engine\source\runtime\core\public\Logging/LogMacros.h(60): note: the constructor and destructor will not be called; a bitwise copy of the class will be passed as the argument
d:\epic\ue_4.22\engine\source\runtime\core\public\Windows/WindowsCriticalSection.h(9): note: see declaration of 'FString'
This is my code:
#include "PosistionReport.h"
#include "Runtime/Core/Public/Math/TransformNonVectorized.h"
#include "Runtime/Core/Public/Math/Vector.h"
#include "Runtime/Engine/Classes/GameFramework/Actor.h"
UPosistionReport::UPosistionReport()
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = true;
// ...
}
// Called when the game starts
void UPosistionReport::BeginPlay()
{
Super::BeginPlay();
FString ObjectName = GetOwner()->GetName();
FString ObjectPos = GetOwner()->GetTransform().GetLocation().ToString();
UE_LOG(LogTemp, Warning, TEXT("%s is at %s"), *ObjectName, ObjectPos);
}
// Called every frame
void UPosistionReport::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
// ...
}