Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Problem with INCPATH
Qt 6.12 LTS is out! See what's new in the release blog

Problem with INCPATH

Scheduled Pinned Locked Moved Installation and Deployment
2 Posts 2 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    I'm newbie, so please have patience with me.
    I'm using Ubuntu and I have installed Qt 5.1.0 from .run file. QtCreator 2.8 got installed also.
    I added these lines to my .bashrc file:
    @
    export QTDIR=/opt/Qt5.1.0/5.1.0/gcc
    export PATH=$QTDIR/bin:$PATH
    export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
    @

    I tried to comile simple example application:
    @
    #include <QApplication>
    #include <QLabel>

    int main(int argc, char *argv[])
    {
    QApplication app(argc,argv);
    QLabel *label = new QLabel("Hello Qt!");
    label->show();
    return app.exec();
    }
    @

    I did "qmake -project", and "qmake hello.pro", and then I typed "make".
    And that gives me error:
    "hello.cpp:1:24: fatal error: QApplication: No such file or directory
    compilation terminated."

    The problem seems to be in qmake. When I make project with QtCreator it's Makefile has different INCPATH variable, and this phase goes without problem (there are other problems but it's another question).
    This is INCPATH variable in Makefile created through QtCreator:

    "INCPATH = -I/opt/Qt5.1.0/5.1.0/gcc/mkspecs/linux-g++ -I../helloQtCreator -I/opt/Qt5.1.0/5.1.0/gcc/include -I/opt/Qt5.1.0/5.1.0/gcc/include/QtWidgets -I/opt/Qt5.1.0/5.1.0/gcc/include/QtGui -I/opt/Qt5.1.0/5.1.0/gcc/include/QtCore -I. -I. -I."

    And this one is created by qmake through terminal:

    "INCPATH = -I/opt/Qt5.1.0/5.1.0/gcc/mkspecs/linux-g++ -I. -I. -I/opt/Qt5.1.0/5.1.0/gcc/include -I/opt/Qt5.1.0/5.1.0/gcc/include/QtGui -I/opt/Qt5.1.0/5.1.0/gcc/include/QtCore -I."

    Project names are different but why qmake doesn't include
    "-I/opt/Qt5.1.0/5.1.0/gcc/include/QtWidgets"
    when started manualy from terminal?
    And how can I fix it?

    Thank you.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      You are missing

      @QT += widgets@

      in your pro file.

      You can compare the pro files generated by QtCreator and the one by qmake. QtCreator knows that you want to do a widget application so it adds a similar line with a check for Qt4/Qt5 compatibility. qmake doesn't know that so it's up to you to add it.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt
      • Unsolved