[SOLVED]Win7-32bit Linker 2019 error



  • Hi everyone,

    I'm having a problem with a linker error. I can't seem to figure out why. Everything looks right, but a clean/rebuild doesn't fix the issue. I was wondering if you could look at line 46-55 of this paste and tell me what you think? I've also included the .pro file, the compiler output is too large to even be posted in a reply.

    Thanks for any help you can give me!!

    MainWindow.h
    @
    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <QMainWindow>

    namespace Ui {
    class MainWindow;
    }

    class MainWindow : public QMainWindow
    {
    Q_OBJECT

    public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    private slots:
    void on_btnEditor_clicked();

    void on_actionEditor_triggered();
    

    private:
    Ui::MainWindow *ui;
    };

    #endif // MAINWINDOW_H

    /////////////MainWindow.cpp
    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include "wordeditor.h"

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    }

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

    /* error below: mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: virtual __thiscall WordEditor::~WordEditor(void)" (??1WordEditor@@UAE@XZ) referenced in function "private: void __thiscall MainWindow::on_actionEditor_triggered(void)" (?on_actionEditor_triggered@MainWindow@@AAEXXZ)
    mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __thiscall WordEditor::WordEditor(class QWidget *)" (??0WordEditor@@QAE@PAVQWidget@@@Z) referenced in function "private: void __thiscall MainWindow::on_actionEditor_triggered(void)" (?on_actionEditor_triggered@MainWindow@@AAEXXZ)
    debug\SpellingBee.exe:-1: error: LNK1120: 2 unresolved externals */

    void MainWindow::on_actionEditor_triggered()
    {
    WordEditor edit;
    edit.setModal(true);
    edit.exec();
    }
    @
    main.cpp
    @
    #include "mainwindow.h"
    #include <QApplication>

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec&#40;&#41;;
    

    }
    @

    wordeditor.h

    @
    #ifndef WORDEDITOR_H
    #define WORDEDITOR_H

    #include <QDialog>

    namespace Ui {
    class WordEditor;
    }

    class WordEditor : public QDialog
    {
    Q_OBJECT

    public:
    explicit WordEditor(QWidget *parent = 0);
    ~WordEditor();

    private:
    Ui::WordEditor *ui;
    };

    #endif // WORDEDITOR_H
    @

    wordeditor.cpp

    @
    #include "wordeditor.h"
    #include "ui_wordeditor.h"

    WordEditor::WordEditor(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::WordEditor)
    {
    ui->setupUi(this);
    }

    WordEditor::~WordEditor()
    {
    delete ui;
    }
    @

    .pro file

    @
    #-------------------------------------------------

    Project created by QtCreator 2013-05-26T06:14:50

    #-------------------------------------------------

    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = SpellingBee
    TEMPLATE = app

    SOURCES += main.cpp
    mainwindow.cpp
    wordeditor.cpp

    HEADERS += mainwindow.h
    wordeditor.h

    FORMS += mainwindow.ui
    wordeditor.ui
    @



  • OH i see. Slots were auto-generated!! whoops!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.