When attempting to package the game, I get the following error:
MainFrameActions: Packaging (Windows): UnrealBuildTool: f:\projects\dwarrows (ue4)\source\dwarrows\DwarrowsPlayerController.h(62) : error C2719: 'trans': formal parameter with __declspec(align('16')) won't be alignedf:\projects\dwarrows (ue4)\intermediate\build\win32\dwarrows\inc\dwarrows\../../../../../../Source/Dwarrows/DwarrowsPlayerController.h(59) : error C2719: 'trans': formal parameter with __declspec(align('16')) won't be aligned
This is the line that is causing it:
UFUNCTION(Server, Reliable, WithValidation, BlueprintCallable, Category = "TownStructure")
void ApplyTownStructureMovement(ATownStructure* pStructure, FTransform trans);
Any help would be appreciated
EDIT: I have read about building in 64bit when in VS, however, it seems that the editor always builds in 32bit. Might this be the problem?
Thank you Ben, however this causes the generated code to fail at compilation:
This is the code in .generated.inl:
void ADwarrowsPlayerController::ApplyTownStructureMovement(class ATownStructure* pStructure, const FTransform trans)
It seems to have simply disregarded the reference (I’m using 4.2).
this is the error the compiler generates:
Error 1 error C2511: 'void ADwarrowsPlayerController::ApplyTownStructureMovement(ATownStructure *,const FTransform)' : overloaded member function not found in 'ADwarrowsPlayerController' F:\Projects\Dwarrows (UE4)\Intermediate\Build\Win64\Inc\Dwarrows\Dwarrows.generated.inl 73
The error is caused by passing your trans variable by value. FTransform is implemented using vector intrinsics, and instances of it need to have 16-byte alignment. I think the stack is guaranteed to be aligned to 16-bytes on Win64 so the compiler can pass it on the stack correctly, but there’s no such guarantee on Win32 (which is what we use for shipping builds).
The solution is to pass the variable by const reference instead:
void ApplyTownStructureMovement(ATownStructure* pStructure, const FTransform &trans);
Ah, sorry. It seems to be a shortcoming of UnrealHeaderTool when dealing with server functions. I’ve reproduced it here, and I’ll file a bug report.
As a temporary workaround, could you change the FTransform argument into FVector and FRotator arguments instead? (You can pass those by value).
Ah ok, I can use that workaround for sure, thanks very much for your help
Has this been resolved? I am still getting this error as of 4.13.2