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"

[Compile Fail]Extend UButton

I want to extend UButton class but the compiler gives failure. The code is below. It has been generated by using the ue editor already.

Additional Info:

  • I have added "UMG" to PublicDependencyModuleNames.

Code:

 #pragma once
 
 #include "Components/Button.h"
 #include "MyButton.generated.h"
 
 UCLASS()
 class HEROMASTERS_API UMyButton : public UButton
 {
     GENERATED_BODY()
     
 };


Compiler Error:

 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(23): error C2504: 'UContentWidget': base class undefined
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(24): error C3646: 'Super': unknown override specifier
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(24): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(110): error C2061: syntax error: identifier 'UPanelSlot'
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(111): error C2061: syntax error: identifier 'UPanelSlot'
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(24): error C3668: 'UButton::_getUObject': method with override specifier 'override' did not override any base class methods
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(90): error C3668: 'UButton::SynchronizeProperties': method with override specifier 'override' did not override any base class methods
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(94): error C3668: 'UButton::ReleaseSlateResources': method with override specifier 'override' did not override any base class methods
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(98): error C3668: 'UButton::PostLoad': method with override specifier 'override' did not override any base class methods
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(102): error C3668: 'UButton::GetEditorIcon': method with override specifier 'override' did not override any base class methods
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(103): error C3668: 'UButton::GetPaletteCategory': method with override specifier 'override' did not override any base class methods
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(109): error C3668: 'UButton::GetSlotClass': method with override specifier 'override' did not override any base class methods
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(110): error C3668: 'UButton::OnSlotAdded': method with override specifier 'override' did not override any base class methods
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(111): error C3668: 'UButton::OnSlotRemoved': method with override specifier 'override' did not override any base class methods
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(122): error C3668: 'UButton::RebuildWidget': method with override specifier 'override' did not override any base class methods
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(24): error C2440: 'return': cannot convert from 'UButton *' to 'UObject *'
 1>  C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(24): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
 1>c:\users\erayt\documents\unreal projects\heromasters\source\heromasters\MyButton.h(14): error C2440: 'return': cannot convert from 'UMyButton *' to 'UObject *'
 1>  c:\users\erayt\documents\unreal projects\heromasters\source\heromasters\MyButton.h(14): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(23): error C2504: 'UContentWidget': base class undefined
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(24): error C3646: 'Super': unknown override specifier
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(24): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(110): error C2061: syntax error: identifier 'UPanelSlot'
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(111): error C2061: syntax error: identifier 'UPanelSlot'
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(24): error C3668: 'UButton::_getUObject': method with override specifier 'override' did not override any base class methods
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(90): error C3668: 'UButton::SynchronizeProperties': method with override specifier 'override' did not override any base class methods
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(94): error C3668: 'UButton::ReleaseSlateResources': method with override specifier 'override' did not override any base class methods
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(98): error C3668: 'UButton::PostLoad': method with override specifier 'override' did not override any base class methods
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(102): error C3668: 'UButton::GetEditorIcon': method with override specifier 'override' did not override any base class methods
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(103): error C3668: 'UButton::GetPaletteCategory': method with override specifier 'override' did not override any base class methods
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(109): error C3668: 'UButton::GetSlotClass': method with override specifier 'override' did not override any base class methods
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(110): error C3668: 'UButton::OnSlotAdded': method with override specifier 'override' did not override any base class methods
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(111): error C3668: 'UButton::OnSlotRemoved': method with override specifier 'override' did not override any base class methods
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(122): error C3668: 'UButton::RebuildWidget': method with override specifier 'override' did not override any base class methods
 1>C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(24): error C2440: 'return': cannot convert from 'UButton *' to 'UObject *'
 1>  C:\Program Files (x86)\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components/Button.h(24): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
 1>C:\Users\ErayT\Documents\Unreal Projects\HeroMasters\Source\HeroMasters\MyButton.h(14): error C2440: 'return': cannot convert from 'UMyButton *' to 'UObject *'
 1>  C:\Users\ErayT\Documents\Unreal Projects\HeroMasters\Source\HeroMasters\MyButton.h(14): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
 



Product Version: UE 4.10
Tags:
more ▼

asked Dec 16 '15 at 12:57 PM in C++ Programming

avatar image

ErayT
250 36 37 169

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

2 answers: sort voted first

I do not know how and why but I found an article related with UserWidgets and it says that the following header files must be included in the project header file(ProjectName.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"
more ▼

answered Dec 16 '15 at 04:49 PM

avatar image

ErayT
250 36 37 169

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

I think you should include

 #include "Widgets/SCompoundWidget.h"

in the header file.

D.

more ▼

answered Dec 17 '15 at 06:05 AM

avatar image

domzorg
714 49 56 128

(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