Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QLabel class missing.
Forum Updated to NodeBB v4.3 + New Features

QLabel class missing.

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 3.4k 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.
  • S Offline
    S Offline
    skymemory
    wrote on last edited by
    #1

    Hi, I have been coding in C++ for quite a while, but am new to Qt, just wrote a few apps following various tutorial materials. But at the moment, I seem to have a problem that I couldn't include the header file QLabel. I am using Qt creator 3.0, based on Qt 5.2.1., and it was an empty project.

    relevant code is as follow, thanks for help!

    #include <QLabel>
    ....
    QLabel *label = new QLabel("....");
    ...

    The error after compilation simply goes as "QLabel: No such file or directory."

    1 Reply Last reply
    0
    • IamSumitI Offline
      IamSumitI Offline
      IamSumit
      wrote on last edited by
      #2

      hii and welcome to devnet,

      in your .pro file add QT +=gui

      hope it helps.

      Be Cute

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andreyc
        wrote on last edited by
        #3

        I guess you need to add "widgets" to QT variable in your .pro file

        @
        QT += widgets
        @

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andreyc
          wrote on last edited by
          #4

          [quote author="IamSumit" date="1396586844"]hii and welcome to devnet,

          in your .pro file add QT +=gui

          hope it helps.
          [/quote]

          In Qt5 the gui and core modules are "included by default":http://qt-project.org/doc/qt-5/qmake-variable-reference.html#qt

          1 Reply Last reply
          0
          • S Offline
            S Offline
            skymemory
            wrote on last edited by
            #5

            [quote author="andreyc" date="1396586935"]I guess you need to add "widgets" to QT variable in your .pro file

            @
            QT += widgets
            @
            [/quote]

            Thanks,it worked. How wicked...can you explain a bit as for why please?

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

              Hi,

              It's because the widgets have been move to their own module in Qt 5

              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