Can't access QtSerialPort, other includes

  • I have recently installed Qt5.4 on Opensuse 12.3, where I have had
    Qt 4.8 for a while - However, when I try to compile a program that does a lot
    of serial communications and runs well under 4.8,
    (and having taken LIB -lQtSerialPort out of the project file
    and put in QT += serialport)

    I get "No such file or directory" at the line
    #include <QtSerialPort/QtSerialPort>

    I have tried putting into the project file
    INCLUDEPATH += </opt/Qt5.4.0/5.4/gcc_64>
    and variants such as INCLUDEPATH += </opt/Qt5.4.0/5.4/gcc_64/include>

    but this does not help. When I put the whole path in
    #include </opt/Qt5.4.0/5.4/gcc_64/include/QtSerialPort/QtSerialPortDepends>

    I get
    "Q_NULLPTR was not declared in this scope"

    at line 182 of qserialport.h

    explicit QSerialPort(QObject *parent = Q_NULLPTR);

    This runs fine on a machine that I have installed Opensuse13.1 on, where the installation
    was done by Opensuse 13.1.

    Thanks for any hints !!


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Are you sure you are using the correct qmake ? Kit ? Qt version ?

  • Thanks for the reply -

    The Kit and Qt version I checked in the project settings a few times.
    I also uninstalled and re-installed, and tried a different directory
    (/usr/Qt). I installed from an live "installer" and then tried downloading
    the 600ish MByte static installer. These are generic linux,
    I wonder if they're ok with Qt 12.3, or if somehow the include
    directory is mixed up because Qt4.8 is still there.

    I didn't check the qmake - how would I do that?


  • Lifetime Qt Champion

    Did you also update your project to use the new Kit ?

    If you are using Qt Creator to build your project, the qmake version should be set correctly. It must be the one located in your Qt installation.

  • Thanks for your reply.

    I'm not sure what you mean by "update your project". I opened the project in the (new version of) Qt Creator, and under "Tools -> Options -> Build and Run set Kits and Qt versions. Is there something else that should have been done?

  • Could it be the version of g++? It's 4.7 . .

  • If I start a new project, and try to
    #include <QtSerialPort/QtSerialPort. it works!

    DO you think that's the best solution?



  • Lifetime Qt Champion

    At some point, it might be simpler to indeed recreate the project from scratch.

  • Thanks - actually, I tracked it down via qmake to the .pro.user file, which still had the Qt4 information - after deleting it, the system re-created it, and now it compiles - with some annoying complaints (won't take TRUE, insists on true)

  • Lifetime Qt Champion

    You're welcome !

    Good !

    What generates these complaints ?

  • My simple program compiles, but the larger program
    says "QPrinter has not been declared" in file included from /usr/include/QPlainTextEdit", despite my having added
    Qt += printsupport and chanaged the header calls in my code
    as suggested to
    #include <QtPrintSupport/QPrinter>,
    and also
    ‘QT_STATIC_CONST’ does not name a type, which I gather
    is an incompatibility between qwt and Qt5.4

  • Lifetime Qt Champion

    "/usr/include/QPlaintTextEdit" ?

Log in to reply

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