How can i avoid "type UUserWidget incomplete" error in VS?

Hi there,
i try to extend the UserWidget class with my own C++ class and followed the tutorial here:

But i get the “red lines” in Visual Studio in my new UserWidget class with the following error:
Type UUserWidget is incomplete

The header file looks like this:

#pragma once
#include "Blueprint/UserWidget.h"
#include "BottomInfoUserWidget.generated.h"

class MYGAME_API UBottomInfoUserWidget : public UUserWidget

I also included UMG, Slate and SlateCore to my Build file and added the header files to my MyGame.h file

using UnrealBuildTool;

public class MyGame : ModuleRules
	public MyGame(TargetInfo Target)
        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG" });

        PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });



#pragma once

#include "Engine.h"
#include "Runtime/UMG/Public/UMG.h"
#include "Runtime/UMG/Public/UMGStyle.h"
#include "Runtime/UMG/Public/Slate/SObjectWidget.h"
#include "Runtime/UMG/Public/IUMGModule.h"
#include "Runtime/UMG/Public/Blueprint/UserWidget.h"

I already saw this post here but already did everything they suggested.

The code compiles and the Editor / Game runs fine but i still get this annoying errors in visual studio. Is there something i can do about it?

I also have the VS configuration of this link here:

My IntelliSense configuration:


Duplicate question: intellisense errors

I have the proposed visual studio configuration from this link: Setting Up Visual Studio for Unreal Engine | Unreal Engine Documentation
So intellisense can’t be the reason for the problem. except the documentation is not corrent anymore?
I have adjusted my description.

I see you are using GENERATED_BODY, you need to define a constructor with that (AFAIK).

According to this post here i don’t need a constructor anymore since 4.6.

Hi ,

By “red lines” do you mean the squiggle lines where Intellisense detects errors?


I use Visual Assist, and generally have Intellisense turned off, so I don’t see these squiggles. In general, any Intellisense errors can be ignored. The code that you provided is fine, and shouldn’t provide any actual problems. With Intellisense enabled however, you are likely to see a large number of “errors” in the Error List.

None of these errors will prevent the project from building successfully, though. Intellisense tends to have a difficult time with large code bases, such as UE4, and the large amount of reflection that takes place in the Unreal Build Tool when building a project in Visual Studio doesn’t help either. As you use the Engine, you will learn what errors are actually important, and which ones can be safely ignored.

So in this case it wasn’t the fault of Intellisense but Resharper (Jetbrain VisualStudio Extension). When i disable Code Inspection the squiggle are gone. Unfortunately i couldn’t find the setting for this particular error so i have to turn it off completely. Thanks for the help.

Your can also exclude some files from analysis to remove “wrong” errors in certain files.