x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Why am I getting error c2440?

Hello community. So I am currently finishing up the c++ tutorial videos and I am currently trying to get UMG working. I am on:https://wiki.unrealengine.com/Videos/Player?series=PLZlv_N0_O1gYup-gvJtMsgJqnEB_dGiM4&video=jbM4VU8oPYI

I have gotten everything up to 11:30 working. I went through explorer to generate the project files so that I could include "Blueprint/UserWidget.h"

For some reason through I cannot assign the CurrentWidget to the created widget of the HUDClass. To be percise I am getting the following error:

error C2440: '=' : cannot convert from 'UUSerWidget ' to 'UUserWidget '

 //in the cpp file
 if (HUDWidgetClass != nullptr)
     {
         CurrentWidget = CreateWidget<UUSerWidget>(GetWorld(), HUDWidgetClass);
     
     }
 
 //in the h file
 
     //the widget class to use for our hud screen
     UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Rates", Meta = (BlueprintProtected = "true"))
     TSubclassOf<class UUSerWidget> HUDWidgetClass;
 
     //the actual instance of the hud
     UPROPERTY()
     class UUserWidget* CurrentWidget;

Does anyone have any advice/idea about the issue?

Product Version: UE 4.9
Tags:
more ▼

asked Dec 29 '15 at 06:58 PM in C++ Programming

avatar image

cbennett2121
3 2 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hey cbennett2121-

In line 12 of the code you posted you have "class UUSerWidget". Because the code is case sensitive it doesn't understand what UUSerWidget is. If you make the "s" lowercase you should be able to compile successfully.

Cheers

Doug Wilson

more ▼

answered Dec 29 '15 at 07:12 PM

avatar image cbennett2121 Dec 29 '15 at 07:18 PM

Wow, I feel so stupid now. TY

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question