Pointer to incomplete class type is not allowed. GetWorld()->

I’ve been getting weird intellisense behavior since I began with UE 4.2; errors that aren’t errors, slow popups, etc. And the error tab is completely useless.
But I’ve never found this to be evidence of any carelessness from Epic.

The first link you posted didn’t work for me (page not found) and the second was to a project that didn’t compile because of a missing header. How is that carelessness from Unreal?

In this case, the project works, it compiles without issue, there is no error (correct?) - but VS reports one. How is that Unreal being careless? That sounds like VS not responding to the pch and macros properly.

Epic has changed the way Unreal handles includes and precompiled headers in an effort to improve compile times. That means you need to explicitly include headers in some situations where in the past you haven’t. It also means intellisense triggers weird warnings that don’t actually apply. As far as I can see, there’s no actual problem here; and I don’t understand how any of this amounts to carelessness from anyone.

I see, I thought he was offering examples of the carelessness. I misread the comment nesting.

My guess re: UWorld not requiring explicit include is that UWorld really is a universal requirement. You’re going to have a UWorld at all times, except at the very beginning of the game startup, when creating a game instance etc.

With regards to the red line; I get this behavior a lot with new classes. Oftentimes it goes away after compile, or with a rebuild of the project files. But it comes back intermittently with new and sometimes established classes.

It’s not that Unreal knows the UWorld is included; it’s that when you compile VS actually builds all the headers and runs the includes. The red underline is only what intellisense thinks is going to happen. The compile behavior is what matters.

Hey, thanks for coming here.

I’m trying to get the player’s pawn going from UWorld, then getting the FirstPlayerController and then getting its pawn, like this:

auto PlayerPawn = GetWorld()->GetFirstPlayerController()->GetPawn();

And it does, the code compiles successfully but there is something bugging me:

http://i.imgur.com/fL3XUp0.png

http://i.imgur.com/AcmVad6.png

I’ve seen a few post about the same error but in those cases it wont compile, and its solved by adding a missing library in the header file, if that were the case, which library should i add?

Here are the includes on my header file:

http://i.imgur.com/vqcEwW0.png

I know this isn’t critical, because it works. But i still want to know what’s going on, whether its a VS bug or UE4, or if i’m just missing something, thanks!

Just had this discussion in Discord. Some user said:
“basically it wants u to include that or the engine but you don’t need those anymore”
“that’s one example of unreal’s carelessness about c++”

So, can you share these links where people do need to include something?

How does this demonstrate “unreal’s carelessness about c++”?
Isn’t this just intellisense being slow and not dealing with macros/precompiled headers well?

Here is one, and
Another one

That’s my guess, GigasightMedia. Actually i uninstalled VS pro 2017 and tested with VS pro 2015 just to see if it was some recent vs intellisense bug but it wasn’t. Although it seems to work fine with UE 4.10.

(Make sure to remove the + on the end of the first link)

The links show the same error, but it’s a bit different here. It is actually compiling, because Unreal knows that GetWorld is already included somewhere. But I also don’t see why and how this works, because you also include CoreMinimal.h. GetWorld is in Engine/World.h, but even when I include it, I still get a red underline if I want to get access to Pawn. I can use GetFirstPlayerController without any issues.

Slowly, don’t mix things up now. It was me who quoted someone from Discord. OP is not saying that Unreals carelessness is the issues in the link examples. I wrote it’s just a quote from Discord, it was not my intention to say something negative about Unreal, I just wanted to bring this into the discussion.

I’m just trying to understand why you need to include CoreMinimal.h for some core functionality and why UWorld is an exception. <3

To sum up, I made a post about this issue that everyone can read.
Would be awesome to hear if you liked it! <3

Thank you so much that was so helpful!

If there is no more questions to this, it would be great if you could mark this question as resolved! <3