Xcode build errors: Lambda capture...not used

Hey,

Recently I started getting errors about metal shaders not being found in Unreal due to Xcode being out of date. I recently upgraded to High Sierra and the latest Xcode and now i’m unable to open my .uproject file.

I tried deleting binaries, intermediate, saved and the workspace file, then regenerating the workspace file. Now when I try to build from Xcode I get the following build errors:

Lambda capture ‘LocalMapLayoutForCapture’ is not used (UnrealType.h) (this error appears twice)
Lamdba capture ‘LocalSetLayoutForCapture’ is not used (UnrealType.h)

I’m not sure how to deal with these errors - I’ve never seen them before. I was tempted to go and delete them from the UnrealType.h file but don’t want to mess anything up within the engine code.

Using UE4.18.3 and Xcode 9.3.The project was a C++ project and was compiling just fine until it started saying Xcode was the wrong version and giving me the metal shader errors.

Anyone know how to get around this? :slight_smile:
Thanks

I also run into this errors generated from [-Werror,-Wunused-lambda-capture] setting using Xcode 9.3 and was able to work around it with downgrading to Xcode 9.0.

As an alternative you could also consider to modify UEBuildTool in such a way that the compiler handles unused lambda captures only as warnings, what shouldn’t be a big issue anyways as they just should be optimised out.

You need to change MacToolChain.cs in UnrealBuildTool to not treat unused captures as errors.

Find the following line:

Result += " -Wno-unused-value";

and below add

Result += " -Wno-unused-lambda-capture";

then you have to rebuild UnrealBuildTool by cd-ing into Engine/Source/Programs/UnrealBuildTool and execute the following command

xbuild UnrealBuildTool.csproj

When that’s complete (with a bunch of other unused warnings) you can head back and re-run Build.sh which should complete without errors.

i did exactly as explained but continued getting the same error: lambda capture 'LocalMapLayoutForCapture' is not used [-Werror,-Wunused-lambda-capture] . Does the fact that i’m compiling via remote from windows changes something?

Hey guys , iam facing the similar issue with unreal engine 4.17 on mac, my xcode version 4.3 while using your solution to compile the project , i was not able to find xbuild command on my mac , can you please guide me about the whole process. and how can i run xbuild command in mac.

Thank you VERY VERY VERY MUCH MAN. It is fixed by downgrading from Xcode 9.4.1 to 9.0.

try build AutomationTool after building UnrealBuildTool.