Compiling error when using OpenDoor

I have been smooth sailing up until this point. I keep getting compiling errors and I can’t figure out why. Thanks to anyone who takes the time to look at this. I uploaded the pictures below.


Rermove the equals sign. The comma operator evaluates each expression and returns the right most so what you have is efectively

FRotator OpenDoor = 0.f;

Thank you! That worked! I also had to change GetActorRotation() to SetActorRotation(). In the Lecture project changes there is an = sign. Just a heads up!

That’s because he’s using {} not (). I meant to make a issue about this to make note of this.


Basically, in a nutshell, initialisation syntax in C++ is a straight up awful mess.

FVector X1 = { 1.f, 2.f, 3.f };
FVector X2{ 1.f, 2.f, 3.f };

X1 and X2 mean exactly the same thing. (Didn’t use to be prior to C++14 so it was a bit more of a mess in C++11)

FVector X3 = (1.f, 2.f, 3.f);
FVector X4(1.f, 2.f, 3.f);

These however do not. In the first the () has the same meaning as ( 1 + 2 ) * 3, where it’s just for order of operations. so

FVector X3 = (1.f, 2.f, 3.f);

Is the same as

FVector X3 =  1.f, 2.f, 3.f;

Which as explained previously is the same as

FVector X3 = 3.f;

Whereas X1, X2, and X4 call the constructor that takes 3 floats.
https://docs.unrealengine.com/en-US/API/Runtime/Core/Math/FVector/__ctor/9/index.html

Edit: Just realised we’re talking about FRotator here but the same applies.


If you want to get really into how it’s a mess, here’s an hour long talk that goes over that

https://www.youtube.com/watch?v=7DTlWPgX6zs

Wow, Thank you for the clarification! I literally would of never figured that out lol. I’ll check out the resources you linked. thanks again!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms