I’m experimenting with C++20 modules using UE 5.3
Version: 5.3.1-28051148+++UE5+Release-5.3
Platform: Windows 10 (22H2) [10.0.19045.3570] (x86_64)
Using Visual Studio 2022 14.36.32542
I’ve added bEnableCppModules = true;
to the Target.cs
build file, but now UBT crashes with the following exception:
Unhandled exception: System.InvalidCastException: Unable to cast object of type 'UnrealBuildTool.Action' to type 'UnrealBuildTool.ICppCompileAction'.
at UnrealBuildTool.BuildMode.BuildAsync(TargetMakefile[] Makefiles, List`1 TargetDescriptors, BuildConfiguration BuildConfiguration, BuildOptions Options, FileReference WriteOutdatedActionsFile, ILogger Logger) in X:\Games\UE_5.3\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 617
at UnrealBuildTool.BuildMode.BuildAsync(List`1 TargetDescriptors, BuildConfiguration BuildConfiguration, ISourceFileWorkingSet WorkingSet, BuildOptions Options, FileReference WriteOutdatedActionsFile, ILogger Logger, Boolean bSkipPreBuildTargets) in X:\Games\UE_5.3\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 411
at UnrealBuildTool.BuildMode.ExecuteAsync(CommandLineArguments Arguments, ILogger Logger) in X:\Games\UE_5.3\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 252
at UnrealBuildTool.UnrealBuildTool.Main(String[] ArgumentsArray) in X:\Games\UE_5.3\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 659
The source code is Container.ixx
:
export module Container;
export class AContainer;
UCLASS()
class SANDBOX_API AContainer : public AActor
{
GENERATED_BODY()
public:
AContainer() = default;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override
{
UE_LOG(LogBlueprint, Warning, TEXT("Hello from container!"));
}
};
I’m new to the forums and I don’t know the proper way of reporting what I believe to be a bug in UBT.