QSerialPort windows problem



  • Newly installed qt creator, i don't know if an add-onis needed (Qt Creator 4.0 based on Qt 5.6)

    a terminal program. only main.cpp

    #include <QCoreApplication>
    #include <QtSerialPort/QSerialPort>
    #include <QtSerialPort/QSerialPortInfo>

    int main(int argc, char *argv[])
    {
    QCoreApplication a(argc, argv);
    QSerialPort serial;

    return a.exec();
    

    }

    When I add QSerialPort serial;, I obtain the following errors:

    main.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QSerialPort::QSerialPort(class QObject *)" (_imp??0QSerialPort@@QEAA@PEAVQObject@@@Z) referenced in function main

    main.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl QSerialPort::~QSerialPort(void)" (_imp??1QSerialPort@@UEAA@XZ) referenced in function main

    debug\QSerialPortProbe.exe:-1: error: LNK1120: 2 unresolved externals

    Like always, please some help will be wellcomed.

    Thanks in advance. Greetings


  • Qt Champions 2016

    hi
    do you have
    QT += serialport
    in the .pro file?



  • No, that fixed the problem. Thank you very much!


Log in to reply
 

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