Xcode13.3 with unreal4.26.2 create c++ project error

Xcode 13.3
unreal 4.26.2

create empty C++ project got error!!

Running Mono…

Running bundled mono, version: Mono JIT compiler version 5.16.0.220 (2018-06/bb3ae37d71a Fri Nov 16 17:12:11 EST 2018)
/Users/Shared/Epic Games/UE_4.26/Engine /Users/Shared/Epic Games/UE_4.26/Engine/Binaries/Mac
Creating makefile for FirstGameEditor (no existing makefile)
@progress push 5%
Parsing headers for FirstGameEditor
Running UnrealHeaderTool “/Users/andrew/Projects/FirstGame/FirstGame.uproject” “/Users/andrew/Projects/FirstGame/Intermediate/Build/Mac/x86_64/FirstGameEditor/Development/FirstGameEditor.uhtmanifest” -LogCmds=“loginit warning, logexit warning, logdatabase error” -Unattended -WarningsAsErrors -abslog="/Users/andrew/Library/Application Support/Epic/UnrealBuildTool/Log_UHT.txt" -installed
Reflection code generated for FirstGameEditor in 4.4266458 seconds
@progress pop
Building FirstGameEditor…
Performing 13 actions (12 in parallel)
[1/13] Compile SharedPCH.Engine.ShadowErrors.h
In file included from /Users/andrew/Projects/FirstGame/Intermediate/Build/Mac/x86_64/FirstGameEditor/Development/Engine/SharedPCH.Engine.ShadowErrors.h:281:
In file included from /Users/Shared/Epic Games/UE_4.26/Engine/Source/Runtime/Engine/Public/EngineSharedPCH.h:572:
/Users/Shared/Epic Games/UE_4.26/Engine/Source/Runtime/Engine/Classes/Materials/Material.h:1269:26: error: variable ‘LayerNames’ set but not used [-Werror,-Wunused-but-set-variable]
const TArray* LayerNames = &LayersExpression->GetLayerNames();
^
1 error generated.

any idea?

3 Likes

+1 just started seeing this exact same error. Showed up after last night and an update to Xcode. But I am on 4.27.2

1 Like

I’m also stuck on this. It showed up after a mac update :frowning:

You can open the “UnrealBuildTool.sln” project in Engine folder, with visual studio.
search “-Wall”, and remove it.
rebuild the UnrealBuildTool, and then, it will works.

because unreal UBT make all warning to error.

2 Likes

It worked! Thanks!

For those who still need to fix it, the file is located at: “/Users/Shared/Epic Games/UE_4.27/Engine/Source/Programs/UnrealBuildTool/Platform/Mac/MacToolChain.cs” and the solution at: “/Users/Shared/Epic Games/UE_4.27/Engine/Source/Programs/UnrealBuildTool/UnrealBuildTool.csproj”

2 Likes

Thanks, @yao_great and @valentegamedev !!

I had downgraded to Xcode 13.2.1 because of this. (Which also works.)

The problem is the “-Werror” argument. Simple things like variables being set but not used was causing the build to fail.

I had tried to fix this problem by change unreal source code.

remove the code below from MacToolChain.cs:

Result += " -Wall -Werror";

3 Likes

Thank you @yao_great and @valentegamedev! @sfjohnston @SimonLee I think the problem is actually the -Wall argument, I left the -Werror argument in as I was concerned removing this would cause it to ignore actual errors, too. The line in my file now reads:
Result += " -Werror";
and it worked after I rebuilt UnrealBuildTool.csproj.

I’m a novice (started learning UE/C++ last week) so I’m a little embarrassed to say I spent over an hour trying to figure out how to rebuild the project after I found this thread. In an effort to save some other novice several hours of frustration:
open /Users/Shared/Epic Games/UE_4.27/Engine/Source/Programs/UnrealBuildTool/UnrealBuildTool.csproj in Visual Studios to rebuild it. Xcode won’t build it because it’s in C# and I couldn’t figure it out through command line (tried both xcodebuild and build.sh). I had erroneously assumed Visual Studios and Xcode were PC and Mac versions of the same thing. Like I said, novice.

2 Likes

Thanks ! its real right

Thanks !!! In my end, It works but I also had to comment on the below two lines :

UE_4.27/Engine/Source/Runtime/Engine/Classes/Materials/Material.h:1279

//const TArray* LayerNames = &LayersExpression->GetLayerNames();

UE_4.27/Engine/Source/Runtime/Engine/Classes/Materials/Material.h:1293

//LayerNames = &LayersParameter.Value.LayerNames;

After doing this, I deleted my old empty c++ project and created a new empty c++ project, it compiled & build successfully.

[Unreal Engine 4.27.2]