Search code examples
c++qtqwidgetmultiple-definition-error

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.

Also there is not any function body on .h files, everything is on .cpp files. Using #ifndef #define.

Also have another QWindow class almost the same (in structure, not names) but that one works fine.

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

#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);
    }
*/
}

enter image description here


Solution

  • Had to delete all the class files (.cpp, .h, .ui) and redo it again but with different name (class name)