Error: loop variable 'PathSegment' of type 'const FName'

Now getting this error when trying to compile on this lesson:

Candidate modules for hot reload:
  ToonTanks
Launching UnrealBuildTool... [/Users/Shared/Epic Games/UE_4.25/Engine/Binaries/DotNET/UnrealBuildTool.exe  -ModuleWithSuffix=ToonTanks,4941 ToonTanksEditor Mac Development -Project="/Users/dan/dev/ToonTanks/ToonTanks.uproject" "/Users/dan/dev/ToonTanks/ToonTanks.uproject"  -IgnoreJunk]
Warning: Starting HotReload took  0.0s.
CompilerResultsLog: New page: Compilation - Dec 2, 2020, 5:02:23 PM
CompilerResultsLog: Running Mono...
CompilerResultsLog: Found mono via known Mono.framework path
CompilerResultsLog: Running system mono/msbuild, version: Mono JIT compiler version 6.12.0.90 (2020-02/d3daacdaa80 Thu Jul 30 16:18:06 EDT 2020)
CompilerResultsLog: /Users/Shared/Epic Games/UE_4.25/Engine /Users/Shared/Epic Games/UE_4.25/Engine/Binaries/Mac
CompilerResultsLog: Using 'git status' to determine working set for adaptive non-unity build (/Users/dan/dev/ToonTanks).
CompilerResultsLog: Building ToonTanksEditor...
CompilerResultsLog: [Upgrade]
CompilerResultsLog: [Upgrade] Using backward-compatible build settings. The latest version of UE4 sets the following values by default, which may require code changes:
CompilerResultsLog: [Upgrade]     bLegacyPublicIncludePaths = false                 => Omits subfolders from public include paths to reduce compiler command line length. (Previously: true).
CompilerResultsLog: [Upgrade]     ShadowVariableWarningLevel = WarningLevel.Error   => Treats shadowed variable warnings as errors. (Previously: WarningLevel.Warning).
CompilerResultsLog: [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).
CompilerResultsLog: [Upgrade] Suppress this message by setting 'DefaultBuildSettings = BuildSettingsVersion.V2;' in ToonTanksEditor.Target.cs, and explicitly overriding settings that differ from the new defaults.
CompilerResultsLog: [Upgrade]
CompilerResultsLog: Performing 17 actions (16 in parallel)
CompilerResultsLog: [1/17] Compile SharedPCH.Engine.h
CompilerResultsLog: In file included from /Users/dan/dev/ToonTanks/Intermediate/Build/Mac/ToonTanksEditor/Development/Engine/SharedPCH.Engine.h:286:
CompilerResultsLog: In file included from /Users/Shared/Epic Games/UE_4.25/Engine/Source/Runtime/Engine/Public/EngineSharedPCH.h:285:
CompilerResultsLog: In file included from /Users/Shared/Epic Games/UE_4.25/Engine/Source/Runtime/CoreUObject/Public/UObject/Class.h:28:
CompilerResultsLog: /Users/Shared/Epic Games/UE_4.25/Engine/Source/Runtime/CoreUObject/Public/UObject/FieldPath.h:257:20: error: loop variable 'PathSegment' of type 'const FName' creates a copy from type 'const FName' [-Werror,-Wrange-loop-analysis]
CompilerResultsLog:                 for (const FName PathSegment : InPropertyPath.Path)
CompilerResultsLog:                                  ^
CompilerResultsLog: /Users/Shared/Epic Games/UE_4.25/Engine/Source/Runtime/CoreUObject/Public/UObject/FieldPath.h:257:8: note: use reference type 'const FName &' to prevent copying
CompilerResultsLog:                 for (const FName PathSegment : InPropertyPath.Path)
CompilerResultsLog:                      ^~~~~~~~~~~~~~~~~~~~~~~~~
CompilerResultsLog:                                  &
CompilerResultsLog: 1 error generated.
LogMainFrame: MainFrame: Module compiling took 13.403 seconds
Warning: HotReload failed, recompile failed

Turns out Unreal 4.25.3 is not compatible with XCode 12. I had to downgrade (details here macOS Catalina) and my code is compiling again.

It strikes me just how much time I spend hunting down compatibility errors that have nothing to do with what I’m learning. As a web and mobile developer, even this level of touchiness is surprising.

1 Like

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

Privacy & Terms