简体   繁体   English

如何解决“C2660 'SWidget::Construct':函数不接受 1 个参数”?

[英]How to resolve "C2660 'SWidget::Construct': function does not take 1 arguments"?

How can I resolve我该如何解决

C2660 'SWidget::Construct': function does not take 1 arguments C2660 'SWidget::Construct': 函数不接受 1 个参数

I am trying to put a widget that displays the controls of the game.我正在尝试放置一个显示游戏控件的小部件。
I am new to Unreal Engine.我是虚幻引擎的新手。

Error错误

C2660 'SWidget::Construct': function does not take 1 arguments C2660 'SWidget::Construct': 函数不接受 1 个参数
C:\\Program Files\\Epic Games\\ UE_4.26 \\Engine\\Source\\Runtime\\SlateCore\\Public\\Widgets\\ DeclarativeSyntaxSupport.h 862 C:\\Program Files\\Epic Games\\ UE_4.26 \\Engine\\Source\\Runtime\\SlateCore\\Public\\Widgets\\ DeclarativeSyntaxSupport.h 862

SPanelWidget.h面板控件.h

#pragma once

#include "SlateBasics.h"
#include "SlateExtras.h"

class SPanelWidget : public SCompoundWidget
{
public:

    SLATE_BEGIN_ARGS(SPanelWidget) {}
    SLATE_ARGUMENT(TWeakObjectPtr<class AControlPanel>, OwningPanel)
    SLATE_END_ARGS()

    void construct(const FArguments& InArgs);

    TWeakObjectPtr<class AControlPanel> OwningPanel;

    virtual bool SupportsKeyboardFocus() const override {return true;};

};

SPanelWidget.cpp面板控件.cpp

#include "SPanelWidget.h"

#define LOCTEXT_NAMESPACE "Panel"

void SPanelWidget::construct(const FArguments& InArgs) {
    const FText TitleText = LOCTEXT("ProjectTitle","Chair Table Practice Problem");
    const FMargin ContentPadding = FMargin(500.f,300.f);
    ChildSlot [
        SNew(SOverlay)
            + SOverlay::Slot()
            .HAlign(HAlign_Fill)
            .VAlign(VAlign_Fill) [
                SNew(SImage)
                    .ColorAndOpacity(FColor::Black)
            ]
            + SOverlay::Slot()
            .HAlign(HAlign_Fill)
            .VAlign(VAlign_Fill)
            .Padding(ContentPadding) [
                SNew(SVerticalBox)
                    +SVerticalBox::Slot() [
                        SNew(STextBlock)
                            .Text(TitleText)
                    ]
            ]
    ];
}

#undef LOCTEXT_NAMESPACE

Need to declare Construct function with an upper case 'C' .需要用大写的'C'声明Construct函数。

Credit: splodginald信用:splodginald

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 C ++错误C2660:函数没有3个参数 - C++ Error C2660: Function does not take 3 arguments 奇怪的错误c2660“函数不带1个参数” - Strange error c2660 “function does not take 1 arguments” 错误C2660:函数没有2个参数C ++ - Error C2660: function does not take 2 arguments C++ 错误C2660:&#39;MouseListener :: MousePressed&#39;:函数未采用4个参数 - error C2660: 'MouseListener::MousePressed' : function does not take 4 arguments 错误C2660:&#39;Aba :: f&#39;:函数未使用0个参数 - error C2660: 'Aba::f' : function does not take 0 arguments 简短版本:错误14错误C2660:“ Player :: addSpell”:函数未采用1个参数 - Short version: Error 14 error C2660: 'Player::addSpell' : function does not take 1 arguments 错误 C2660: 'std::allocator<char> ::allocate': function 不占用 2 arguments</char> - error C2660: 'std::allocator<char>::allocate': function does not take 2 arguments 错误 C2660: 'std::pair<a,b> ::pair': function 不带 2 arguments</a,b> - error C2660: 'std::pair<a,b>::pair': function does not take 2 arguments C ++中的特征库给出错误C2660:&#39;Eigen :: MatrixBase <Derived> :: eigenvalues&#39;:函数不带2个参数 - eigen library in C++ gives error C2660: 'Eigen::MatrixBase<Derived>::eigenvalues' : function does not take 2 arguments 尝试在 windows 10 上安装 node-ffi 会出现错误:error C2660: 'v8::FunctionTemplate::GetFunction': function does not take 0 arguments - trying to install node-ffi on windows 10 gives error: error C2660: 'v8::FunctionTemplate::GetFunction': function does not take 0 arguments
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM