Skip to main content

Compiler Flags

How to pass compiler flags such as /Zc:nrvo- to the Unreal build process.

Visual Studio debugger can't see C structs if they are returned in a function

This has been raised as a bug in the MSVC compiler here and as at September 2025 there is no fix.

When debugging a function which returns a struct created in that function, like this:

FSavitskyResult Savitsky2(const FSavitskyInput& In)
{
FSavitskyResult Out;
Out.Lift = ...
return Out;
}

the compiler won't show you the members of the struct, instead you see this error message:

There is more discussion of the cause of this problem here and here

The workaround is to pass the flag /Zc:nrvo- on the compiler line.

To do this add this to the project [ProjectName]EditorTarget.cs file:

if (Target.Configuration == UnrealTargetConfiguration.Debug || 
Target.Configuration == UnrealTargetConfiguration.DebugGame)
{
bOverrideBuildEnvironment = true;
AdditionalCompilerArguments += "/Zc:nrvo-";
}

Once you have made this change and recompiled the project you should be able to see the members of the struct:

References

Build Tool Target Reference