VS 2022 build versions possibly finally solved

Dannte suggested changing C++17 to C++20, in this link: from UE_5.3 to UE_5.6 -> can't compile old project - #6 by Dannte.

I asked Google AI, here was the response:

Changing C++ standard for Unreal Engine 5.6 Plugins

While Unreal Engine 5.6 and its plugins generally default to C++17, you can modify a plugin to utilize C++20 features. This involves changes within the plugin’s module definition.

  1. Locate the plugin’s build file

Each plugin has a [PluginName].Build.cs file located within its Source directory. For example, if your plugin is named “MyPlugin”, the file would be located at Plugins/MyPlugin/Source/MyPlugin/[PluginName].Build.cs.

  1. Modify the build file

Inside the [PluginName].Build.cs file, you need to add or modify a setting to specify the C++ standard. Add the line CppStandard = CppStandardVersion.Cpp20; to your module’s constructor.

Example:


using UnrealBuildTool;

public class MyPlugin : ModuleRules
{
    public MyPlugin(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

        PublicDependencyModuleNames.AddRange(
            new string[]
            {
                "Core",
                // ... add other public dependencies that you statically link with here ...
            }
            );

        PrivateDependencyModuleNames.AddRange(
            new string[]
            {
                "CoreUObject",
                "Engine",
                "Slate",
                "SlateCore",
                // ... add private dependencies that you statically link with here ...
            }
            );

        // Set C++ standard to C++20
        CppStandard = CppStandardVersion.Cpp20;  /***** This is the line to add *****/

        // ... other settings ...
    }
}

  1. Regenerate Visual Studio project files

After modifying the build file, you need to regenerate the Visual Studio project files for the changes to take effect. You can do this by right-clicking on your Unreal Engine project file (.uproject) and selecting “Generate Visual Studio project Files”.

  1. Rebuild the plugin

Once the project files are regenerated, open your solution in Visual Studio and rebuild the plugin.

This process will ensure that the third-party plugin compiles using the C++20 standard, allowing you to utilize C++20 features within its codebase. According to Reddit, this approach is relevant for how third-party libraries are integrated into Unreal Engine plugins.