Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Shipping: formal parameter with __declspec(align('16')) won't be aligned

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?

Product Version: Not Selected
more ▼

asked Jun 02 '14 at 04:10 AM in Packaging & Deployment

avatar image

797 49 60 94

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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);

more ▼

answered Jun 02 '14 at 01:40 PM

avatar image

Ben Marsh STAFF
778 24 9 18

avatar image Grogger Jun 02 '14 at 01:48 PM

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
avatar image Ben Marsh STAFF Jun 02 '14 at 02:16 PM

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).

avatar image mxnko Jan 31 '17 at 05:21 AM

Has this been resolved? I am still getting this error as of 4.13.2

avatar image Grogger Jun 02 '14 at 05:31 PM

Ah ok, I can use that workaround for sure, thanks very much for your help

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question