External errors



  • Code below works with Qt 5.3.2 but when I try to compile it on the 5.4 I get external errors... Also I've noticed many of projects built with Qt 5.3.2 can not be open in 5.4... Always getting error - Could not find qmake configuration file default.
    Error while parsing file C:/Users/Administrator/Documents/phLogin/phLogin.pro. Giving up.

    @#include "Windows.h"
    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <QProcess>
    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    DWORD procId;
    QString pIDClient;
    QString prefix = "cmd /C taskkill /F /S localhost /PID ";
    QString name = "Notepad";
    HWND hwnd = FindWindow(NULL, (LPCTSTR)name.utf16());
    if(hwnd != 0)
    {
    GetWindowThreadProcessId(hwnd, &procId);
    pIDClient = QString::number(procId);
    }

       QProcess *cKill = new QProcess(this);
       QString cIDKill = prefix + pIDClient;
       cKill->start(cIDKill);
    

    }

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

    @mainwindow.obj:-1: error: LNK2019: unresolved external symbol __imp__FindWindowW@8 referenced in function "public: __thiscall MainWindow::MainWindow(class QWidget *)" (??0MainWindow@@QAE@PAVQWidget@@@Z)

    mainwindow.obj:-1: error: LNK2019: unresolved external symbol __imp__GetWindowThreadProcessId@8 referenced in function "public: __thiscall MainWindow::MainWindow(class QWidget *)" (??0MainWindow@@QAE@PAVQWidget@@@Z)@


  • Moderators

    Looks like you've got some linking and qmake problems.

    For a start, I would recommend to do a full clean up of your build, remove .pro.user file, then open and configure the project again using Qt 5.4. I suspect you've got some leftovers from previous builds and they are interfering.


Log in to reply
 

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