E2072 Number of elements (18) differs from declaration (22)

[dcc32 Error] dxOI.pas(604): E2072 Number of elements (18) differs from declaration (22)


  dxPropClassMap: array[TTypeKind] of TdxPropertyEditorClass = (
    nil, TdxIntegerProperty, TdxCharProperty, TdxEnumProperty,
    TdxFloatProperty, TdxStringProperty, TdxSetProperty, TdxClassProperty,
    nil, TdxPropertyEditor, TdxStringProperty, TdxStringProperty,
    TdxPropertyEditor, nil, nil, nil
    {$IFDEF DELPHI4}, TdxInt64Property, nil{$ENDIF}
    );


TTypeKind在D7里定义如下,共18个元素

type
  TTypeKind = (tkUnknown, tkInteger, tkChar, tkEnumeration, tkFloat,
    tkString, tkSet, tkClass, tkMethod, tkWChar, tkLString, tkWString,
    tkVariant, tkArray, tkRecord, tkInterface, tkInt64, tkDynArray);

在XE4里定义是22个

type
  TTypeKind = (tkUnknown, tkInteger, tkChar, tkEnumeration, tkFloat,
    tkString, tkSet, tkClass, tkMethod, tkWChar, tkLString, tkWString,
    tkVariant, tkArray, tkRecord, tkInterface, tkInt64, tkDynArray, 

tkUString,    tkClassRef, tkPointer, tkProcedure);

增加了4个,dxPropClassMap的元素个数与定义不符,修改一样,加几个nil或属性编译器就可以了


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据你提供的错误信息,函数 `MainWindow::selectFile()` 的定义与其声明的返回类型不一致。 在你的 `mainwindow.h` 文件中,`MainWindow::selectFile()` 函数的声明的返回类型是 `int`,但是在 `mainwindow.cpp` 文件中的函数定义中,返回类型被修改为了 `bool`。 要修正这个问题,你需要确保函数的声明和定义的返回类型是一致的。根据你在 `selectFile()` 函数中的实现,返回类型应该是 `bool`。 将 `mainwindow.h` 文件中的函数声明修改为: ```cpp bool selectFile(); ``` 修正后的代码如下所示: **mainwindow.h** ```cpp #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); private slots: bool selectFile(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H ``` **mainwindow.cpp** ```cpp #include "mainwindow.h" #include "ui_mainwindow.h" #include <QDebug> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { QPushButton *selectButton = new QPushButton("选择文件", this); connect(selectButton, &QPushButton::clicked, this, &MainWindow::selectFile); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(selectButton); QWidget *centralWidget = new QWidget(this); centralWidget->setLayout(layout); setCentralWidget(centralWidget); ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } bool MainWindow::selectFile() { QString dir = QFileDialog::getOpenFileName(this, "选择文件", "", "DWG Files (*.dwg)"); if (dir.isEmpty()) { qDebug() << "error: File import failure!"; return false; } else { // 进行导入操作 // ... return true; } } ``` 请确保在 `mainwindow.cpp` 文件中包含了 `#include "mainwindow.h"` 的代码行。这样可以确保函数的定义与声明是一致的。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值