Cannot initialize object parameter of type 'UActorComponent' with an expression of type 'UPositionReport'

Hey! I’m trying to figure out what’s a problem here. I just created UPositionReport class like a subclass of UActorComponent without any additional logic and here is a strange error.

Cannot initialize object parameter of
type ‘UActorComponent’ with an
expression of type ‘UPositionReport’

Before this issue I had another one - SEARCH PATH in Xcode settings wasn’t configured correctly and I fixed it, but this issue remains.

Hey, I’ve got the same issue with both UPositionReport and UOpenDoor components (looks like we’re on the same course, YAY)

The code still builds and runs properly, though

since its a empty component would you please share the .h and .cpp via www.pastebin.com please, either one of you guys?

Got it here: UE4 Basic Component [Unexpected warnings in Xcode] - Pastebin.com

I also placed a couple of these unclear warning messages in the comments on the corresponding expressions in the .cpp

Works as expected. Only thing I changed is BUILDINGESCAPE_API to MYPROJECT_API

Are you guys blindly copy some Code from somewhere by any chance?

Well, it’s the tutorial code from a learning course. The process is quite simple — create new component in the editor, then complete the generated boilerplate code with a couple lines. As I said previously, the code builds and works just fine (in my case, at least) — these warning messages are just an annoyance from an Xcode side. So I wonder is it because Xcode doesn’t get some pieces of code intel from Unreal and whether is it possible to fix this behaviour.

Oh that no clue than but happens in VS too (not that specific error though) but you can safly ignore it as long as it compiles you´re good to go.

(In VS all errors disapear after a restart, I assume because intellisense gets a refresh of the generated code, might be the same for Xcode but cant help you there since im only working on Windows)

Resolved this problem by setting c++14 in project settings of Xcode.

Check my answer

I am struggling to find the setting — could you make a screenshot?

Thank you! I was having the exact same issue. Setting language dialect to c++14 fixed mine too.

Hi @otbivnoe, I did, and fixed my problem. But I have got a new problem. This solution broke my build