Question

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "dialog.h"

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

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

void MainWindow::on_actionDoit_triggered()
{
    Dialog D;
    D.setModal(true);
    D.exec();
}

This small piece of code is giving me linker errors LNK2019 and LNK1120 If I remove the three lines in function void MainWindow::on_actionDoit_triggered(), it works. The tutorial I am following didn't warn of linker problems

Was it helpful?

Solution

Apparently, you got it working without changing the code just by re-running qmake explicitly.

The reason is most likely the fact that you modified your qmake project file(s), and QtCreator has issues with knowing when to re-run qmake properly.

There is a long-standing bug about it:

Creator should know when to rerun qmake

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top