[C++] Can't use UUserWidget


I’m trying to create an Blueprint Widget using c++ but it doesn’t work …

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

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

		PrivateDependencyModuleNames.AddRange(new string[] {  });


#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"


#pragma once

#include "Blueprint/UserWidget.h"
#include "PlayerHUD.generated.h"

class EQUIPEPROJECT_API UPlayerHUD : public UUserWidget

		UUserWidget* HUD;

Thanks !

There’s not enough information in your post. Did you try building your project? If so and it failed, what does the output log say?

hum hum ok it work but I can’t use my UUserWidget :confused: (“UUserWidget” is undefined)

From the comment above, it sounds like you are all set and everything is working. One thing that I think you don’t quite understand about VS and UE4 is that intellisense will more often than not give you false positives on errors. You can not nor should you rely on it.

I posted an answer but just for future reference, post your code using the code notation. There’s no reason to send people to another site just to see your code or even photos.

Ok it’s not convenient … I can not program without knowing if there are errors ?

You’ll know there are errors if it fails to compile. If it does fail to compile, the output log will let you know what’s wrong.

Ok thanks a lot :slight_smile: