UserWidget AddToViewPort

I am trying to add a widget to the viewport in C++. This is something I have done plenty in the past, but there seems to be an error I just can not figure out.

The error I get is pretty self explanatory, but I can not figure out why I would be getting it.

...ProjectHUD.cpp(62): error C2039: 'AddToViewPort': is not a member of 'UUserWidget'
...unrealengine\engine\source\runtime\umg\public\Animation/WidgetAnimationBinding.h(10): note: see declaration of 'UUserWidget'

Project.Build.cs

		PublicDependencyModuleNames.AddRange(
			new string[] { 
				"Core", 
				"CoreUObject", 
				"Engine",
                "InputCore",
                "SlateCore",
                "Slate",
                "UMG",
                "OnlineSubsystem",
                "OnlineSubsystemUtils"
            }
		);

MyProject.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 "Blueprint/UserWidget.h"

ProjectHUD.h (No special includes for widgets here, they are in the Project.h above. I have tried them here though)

UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "User Interface")
TSubclassOf<UUserWidget> LoginMenuClass;

UPROPERTY(BlueprintReadOnly, Category = "User Interface")
UUserWidget* CurrentWidget;

ProjectHUD.cpp (No special includes for widgets here, they are in the Project.h above. I have tried them here though)

CurrentWidget = CreateWidget<UUserWidget>(PlayerController, LoginMenuClass);
CurrentWidget->AddToViewPort(); // Problem is here

I am at a loss here and would appreciate any feedback anyone has!
Thanks.

You have a typo, that is all, I think.

AddToViewport();

not

AddToViewPort();

Wow. After way too much time spent on this it was a typo. I will mark this as an answer if you put it in the answer section!

If you ever get the “is not a member of” error, it is simply stating that whatever you have typed doesn’t exist in the class you’re calling it from. So even if you think that you have spelled it correctly, or that it is there, if you get this error, it’s actually not.

You can always open the class and double check the functions that are included in it and its parent class(es) for what you are trying to use.

Furthermore, you can search the UE4 documentation here:

https://docs.unrealengine.com/latest/INT/

As an example, for AddToViewPort (spelled incorrectly):

https://docs.unrealengine.com/latest/INT/Search/index.html?q=AddToViewPort&x=0&y=0

If you select the “API” tab, you can then see its actually spelled as, AddToViewport( ):

https://docs.unrealengine.com/latest/INT/API/Runtime/UMG/Blueprint/UUserWidget/AddToViewport/index.html

Hope this helps.