Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt Creator - QApplication: No such file or directory
Forum Updated to NodeBB v4.3 + New Features

Qt Creator - QApplication: No such file or directory

Scheduled Pinned Locked Moved Mobile and Embedded
qt creatorautocomplete
11 Posts 3 Posters 9.3k Views 2 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.
  • R Radim
    16 Oct 2015, 14:46

    Hi,

    I successfully configured Qt Creator for cross-compilation and remote debugging. I'm using Qt 4.8.3.

    Everything works perfectly except in the code editor the #include <QApplication> (and all Qt headers) is underlined and I get no assistance when writing code.

    In what directories is the Qt Creator looking for the headers?

    Note: I have a device specific qmake.conf, that uses an environmental variable that contains a sysroot path to configure include and lib paths. For compilation I set the variable in Build Environment in Projects settings.

    R Offline
    R Offline
    Ratzz
    wrote on 17 Oct 2015, 13:09 last edited by
    #2

    Hi,
    In your .pro add following lines.

    QT       += core gui
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    

    In your main.cpp replace #include <QApplication> with <QtGui/QApplication>

    --Alles ist gut.

    R 1 Reply Last reply 19 Oct 2015, 08:55
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 17 Oct 2015, 21:38 last edited by
      #3

      @Ratzz
      QApplication is a widgets module class in Qt 5. To be compatible with both Qt 4 and 5 the include statement should not include the module.

      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
      • R Ratzz
        17 Oct 2015, 13:09

        Hi,
        In your .pro add following lines.

        QT       += core gui
        greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
        

        In your main.cpp replace #include <QApplication> with <QtGui/QApplication>

        R Offline
        R Offline
        Radim
        wrote on 19 Oct 2015, 08:55 last edited by Radim
        #4

        @Ratzz I changed the #include but the include is still underlined and I get no hints in the editor :-( It seems the the Qt Creator has problem finding the file, whilst make works.

        Please note, that the project compiles correctly with both <QApplication> and <QtGui/QApplication>

        Edit: It works if I clear the sysroot path in the Kit. So obviously the Qt Creator uses the sysroot path to scan for header files. If I leave it empty, the Qt Creator however uses the header files of host and not target, which is wrong. I tried to put the header files to <sysroot>/usr/include/qt4, but it still does not work.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 19 Oct 2015, 21:18 last edited by
          #5

          Which version of Qt Creator are we talking about ?

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

          R 1 Reply Last reply 20 Oct 2015, 08:22
          0
          • S SGaist
            19 Oct 2015, 21:18

            Which version of Qt Creator are we talking about ?

            R Offline
            R Offline
            Radim
            wrote on 20 Oct 2015, 08:22 last edited by Radim
            #6

            @SGaist Qt Creator version is 3.0.1 running on Ubuntu 14.04, Qt 4.8.3

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 20 Oct 2015, 19:54 last edited by
              #7

              You should consider updating Qt Creator. Current version is 3.5.1

              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
              • R Offline
                R Offline
                Radim
                wrote on 21 Oct 2015, 10:28 last edited by
                #8

                I know. Only this version is provided for Ubuntu 14.04. Maybe I could install Qt 5.5 next to current installation in order not to corrupt current Qt, which is used by Ubuntu itself. Btw, do you think the 3.5 solves it or it is just to try? Better than trying different versions I would like to know, where the Qt Creator is looking for the header files.

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 21 Oct 2015, 21:40 last edited by
                  #9

                  That you can check in the Kit and Qt Versions for that information

                  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
                  • R Offline
                    R Offline
                    Radim
                    wrote on 22 Oct 2015, 06:32 last edited by
                    #10

                    I know, but I need to know, where exactly. For example in the kit I have sysroot /<some path>. So in what directories the Qt Creator is looking? Is it /<some path>/usr/include/qt or /<some path>/usr/include/qt4 or different one. Btw I tried to put the Qt headers in these both directories and it didn't work. So where to put the Qt header files in the sysroot folder in order the Qt Creator finds them?

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 31 Oct 2015, 23:35 last edited by
                      #11

                      AFAIK, it should use the prefix set at compilation time to search that

                      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 Extensions
                      • Unsolved