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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Extend UButton in c++

I want to extend UButton class but the compiler gives failure.

 #pragma once
 
 #include "Components/Button.h"
 #include "BtnSlot.generated.h"
 
 UCLASS()
 class TOWERDEFENCE_API UBtnSlot : public UButton
 {
     GENERATED_BODY()
     
 };

Severity Code Description Project File Line Error MSB3073 The command ""C:\Program Files\Epic Games\4.10\Engine\Build\BatchFiles\Build.bat" TowerDefenceEditor Win64 Development "D:\ProjetosUE4\ProjetoX\projetox\TowerDefence\TowerDefence.uproject" -rocket -waitmutex" exited with code -1. TowerDefence C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets 37 Error C2504 'UContentWidget': base class undefined TowerDefence C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components\Button.h 23 Error C2504 'UContentWidget': base class undefinedC:\Program Files\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 TowerDefence C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components\Button.h 23 Error C3646 'Super': unknown override specifier TowerDefence C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components\Button.h 24 Error C3646 'Super': unknown override specifier TowerDefence C:\Program Files\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 TowerDefence C:\Program Files\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 TowerDefence C:\Program Files\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 TowerDefence C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components\Button.h 24 Error C2440 'return': cannot convert from 'UButton ' to 'UObject ' TowerDefence C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components\Button.h 24 Error C2440 'return': cannot convert from 'UButton ' to 'UObject ' TowerDefence C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components\Button.h 24 Error C3668 'UButton::SynchronizeProperties': method with override specifier 'override' did not override any base class methods TowerDefence C:\Program Files\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 TowerDefence C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components\Button.h 90 Error C3668 'UButton::ReleaseSlateResources': method with override specifier 'override' did not override any base class methods TowerDefence C:\Program Files\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 TowerDefence C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components\Button.h 94 Error C3668 'UButton::PostLoad': method with override specifier 'override' did not override any base class methods TowerDefence C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components\Button.h 98 Error C3668 'UButton::GetEditorIcon': method with override specifier 'override' did not override any base class methods TowerDefence C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components\Button.h 102 Error C3668 'UButton::GetPaletteCategory': method with override specifier 'override' did not override any base class methodsC:\Program Files\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 TowerDefence C:\Program Files\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 methodsC:\Program Files\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 TowerDefence C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components\Button.h 103 Error C3668 'UButton::GetSlotClass': method with override specifier 'override' did not override any base class methodsC:\Program Files\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 TowerDefence C:\Program Files\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 TowerDefence C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components\Button.h 109 Error C2061 syntax error: identifier 'UPanelSlot' TowerDefence C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components\Button.h 110 Error C2061 syntax error: identifier 'UPanelSlot' TowerDefence C:\Program Files\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 TowerDefence C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components\Button.h 110 Error C2061 syntax error: identifier 'UPanelSlot' TowerDefence C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components\Button.h 111 Error C2061 syntax error: identifier 'UPanelSlot' TowerDefence C:\Program Files\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 TowerDefence C:\Program Files\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 TowerDefence C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components\Button.h 111 Error C3668 'UButton::RebuildWidget': method with override specifier 'override' did not override any base class methods TowerDefence C:\Program Files\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 TowerDefence C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\UMG\Public\Components\Button.h 122 Error Failed to produce item: D:\ProjetosUE4\ProjetoX\projetox\TowerDefence\Binaries\Win64\UE4Editor-TowerDefence-3138.dll TowerDefence D:\ProjetosUE4\ProjetoX\projetox\TowerDefence\Intermediate\ProjectFiles\ERROR 1 Error (active) this declaration has no storage class or type specifier TowerDefence d:\ProjetosUE4\ProjetoX\projetox\TowerDefence\Source\TowerDefence\BtnSlot.h 11 Error (active) expected a ';' TowerDefence d:\ProjetosUE4\ProjetoX\projetox\TowerDefence\Source\TowerDefence\BtnSlot.h 12 Error C2440 'return': cannot convert from 'UBtnSlot ' to 'UObject ' TowerDefence d:\projetosue4\projetox\projetox\towerdefence\source\towerdefence\BtnSlot.h 20 Error C2440 'return': cannot convert from 'UBtnSlot ' to 'UObject ' TowerDefence D:\ProjetosUE4\ProjetoX\projetox\TowerDefence\Source\TowerDefence\BtnSlot.h 20

Product Version: UE 4.10
Tags:
more ▼

asked Feb 22 '16 at 05:11 AM in C++ Programming

avatar image

Edney Reis
56 3 5 10

avatar image Edney Reis Feb 22 '16 at 10:51 PM
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Hi Edney,

There are a couple things that you need to do to get this to work. First, make sure you have added the Slate, SlateCore, and UMG modules to the Public Dependency Module Names in your project's Build.cs file. Second, open your project's header file and add a #include "UMG.h" line.

Once you have done that, your project should build fine.

Tim

more ▼

answered Jan 12 '17 at 10:37 PM

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

Before you #include Button.h ,you need to #include ContentWidget.h alt text

ff.png (6.6 kB)
more ▼

answered Jan 12 '17 at 03:59 AM

avatar image

VenomAnti
1

(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