Download

problem make the login widget work

i using this tuturial to make my login screen in c++
i using visual studio 2015 Comunity and Unreal Engine 4.15.2https://youtube.com/watch?v=1wY35cep5V4and i have this errors
Severity Code Description Project File Line Suppression State
Error (active) pointer to incomplete class type is not allowed FirstGame c:\Users\Pedro\Documents\Unreal Projects\FirstGame\Source\FirstGame\StateManager.cpp 41
Error C2275 ‘UUserWidget’: illegal use of this type as an expression FirstGame C:\Users\Pedro\Documents\Unreal Projects\FirstGame\Source\FirstGame\StateManager.cpp 40
Error C2027 use of undefined type ‘UUserWidget’ FirstGame C:\Users\Pedro\Documents\Unreal Projects\FirstGame\Source\FirstGame\StateManager.cpp 41
Error C2227 left of ‘->AddToViewport’ must point to class/struct/union/generic type FirstGame C:\Users\Pedro\Documents\Unreal Projects\FirstGame\Source\FirstGame\StateManager.cpp 41
Error (active) type name is not allowed FirstGame c:\Users\Pedro\Documents\Unreal Projects\FirstGame\Source\FirstGame\StateManager.cpp 40

my code


// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "Engine/GameInstance.h"
#include "StateManager.generated.h"

/*Unumeration class */
UENUM(BlueprintType)
enum class EGameState :uint8 {
	ENone			UMETA(DisplayName = "None"),
	EStartup		UMETA(DisplayName = "Start"),
	ELoginScreen	UMETA(DisplayName = "LoginScreen"),
};
/**
 * 
 */
UCLASS()
class FIRSTGAME_API UStateManager : public UGameInstance
{
	GENERATED_BODY()
	

public:

	UPROPERTY(EditDefaultsOnly, Category = "State Manager")
		TSubclassOf<class UUserWidget> cLoginMenu;
	
	virtual void Init() override;

	UFUNCTION(BlueprintCallable, Category = "State Manager")
		void ChangeState(EGameState newState);

	EGameState GetGameState();

private:

	UUserWidget *currentWidget;
	

	EGameState currentState;

	void EnterState(EGameState newState);
	void LeaveState(EGameState oldState);
};


Severity	Code	Description	Project	File	Line	Suppression State
Error	C2275	'UUserWidget': illegal use of this type as an expression	FirstGame	C:\Users\Pedro\Documents\Unreal Projects\FirstGame\Source\FirstGame\StateManager.cpp	40	
Error	C2027	use of undefined type 'UUserWidget'	FirstGame	C:\Users\Pedro\Documents\Unreal Projects\FirstGame\Source\FirstGame\StateManager.cpp	41	
Error	C2227	left of '->AddToViewport' must point to class/struct/union/generic type	FirstGame	C:\Users\Pedro\Documents\Unreal Projects\FirstGame\Source\FirstGame\StateManager.cpp	41	


You need to add the UserWidget.h header file to your .cpp file.

You also probably need to include the “UMG”, “Slate” and “SlateCore” dependencies to your projects build.cs file.

thanks
for the help its work
Have a good day , night or afternoon
Have a good weekend

how i change umg for another by widget when i click in button code
i using this tutorial to make my login system 02 - [C++] GameSparks in Unreal Engine - Building the Login System (1/2) - YouTube

void ULoginMenuWidget::OnOptionsClicked()
{

if (GetWorld()-&gt;GetGameInstance())
{
	UStateManager *StateManager = Cast&lt;UStateManager&gt;(GetWorld()-&gt;GetGameInstance()); 
	if (StateManager) 
	{ StateManager-&gt;ChangeState(EGameState::EOptionsScreen);
	}
}
/*
if (GEngine) {
	GEngine-&gt;AddOnScreenDebugMessage(-1, 2.f, FColor::MakeRandomColor(), TEXT("Options"));
}
/**/

}
and i click in the options button my game crash