简体   繁体   English

QT多重定义

[英]QT multiple definitions

I've been trying to solve this issue and nothing seems to work, tryed clean the project, run qmake, made sure there was no recursive includes between files, but still showing the error.我一直在尝试解决这个问题,但似乎没有任何效果,尝试清理项目,运行 qmake,确保文件之间没有递归包含,但仍然显示错误。

Also there is not any function body on .h files, everything is on .cpp files. .h 文件上也没有任何函数体,一切都在 .cpp 文件上。 Using #ifndef #define.使用#ifndef #define。

Also have another QWindow class almost the same (in structure, not names) but that one works fine.还有另一个几乎相同的 QWindow 类(在结构上,而不是名称上),但该类工作正常。

The errors appear only in this class but in all functions, don't know what could be causing the error.错误只出现在这个类中,但在所有函数中,不知道是什么导致了错误。

Here's the code:这是代码:

rlwindow.h窗口文件

#ifndef RLWINDOW_H
#define RLWINDOW_H

#include <QWidget>
#include <QString>
#include <string.h>

#include "Utilities.h"
//#include "fmanager.h"


namespace Ui {class rlWindow;}


class rlWindow : public QWidget
{
    Q_OBJECT

public:
    explicit rlWindow(bool login, QWidget *parent = nullptr);
    ~rlWindow();

private slots:
    void on_ContinueButton_clicked();

private:
    Ui::rlWindow *ui;
    //fmanager *Manager;
    pair<string> UserData;
    bool LoR; // True = Login / False = Register

};

#endif // RLWINDOW_H

rlwindow.cpp rlwindow.cpp

#include "rlwindow.h"
#include "ui_rlwindow.h"

rlWindow::rlWindow(bool login, QWidget *parent) :
    QWidget(parent), ui(new Ui::rlWindow)
{
    ui->setupUi(this);
    //Manager = new fmanager("Data.txt");
    LoR = login;

    if(LoR){
        ui->TitleLabel->setText("Ingresar");
        ui->ContinueButton->setText("Ingresar");
    }
    else{
        ui->TitleLabel->setText("Registro");
        ui->ContinueButton->setText("Registrar");
    }
}

rlWindow::~rlWindow()
{
    delete ui;
}

void rlWindow::on_ContinueButton_clicked()
{/*
    UserData.first = ui->UserNameForm->text().toStdString();
    UserData.second = ui->UserPassForm->text().toStdString();

    if(LoR){
        for(uint i = 0; Manager->Data().size() > i; i++){

            if(Manager->Data()[i][0] == UserData.first && Manager->Data()[i][1] == UserData.second){

            }

        }
    }
    else{
        bool aux = false;
        for(uint i = 0; Manager->Data().size() > i; i++){

            if(Manager->Data()[i][0] == UserData.first){
                aux = true;
                break;
            }
        }
        if(!aux)
            Manager->addItem(UserData.first, UserData.second);
    }
*/
}

在此处输入图片说明

不得不删除所有的类文件(.cpp、.h、.ui)并再次重做,但名称不同(类名)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM