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. Can't get rid of ld error: undefined reference to `_imp___ZN12QApplicationC1ERiPPci'
Forum Updated to NodeBB v4.3 + New Features

Can't get rid of ld error: undefined reference to `_imp___ZN12QApplicationC1ERiPPci'

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 2.9k 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.
  • G Offline
    G Offline
    Gazette
    wrote on last edited by
    #1

    Hello

    I use qt-opensource-windows-x86-mingw492-5.5.1.exe on my WinXP laptop on which I previously installed mingw32. I try to build sample program I saw on a book, but I got stuck at this point. Picture for quick explanation:

    link text

    and also, I takes too long to remake the Makefile using qmake -project, I had to quit it after 4-5 minutes.

    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 not linking the QtWidgets module. Add QT += widgets to your .pro file.

      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
      • G Offline
        G Offline
        Gazette
        wrote on last edited by
        #3

        Thank you, it worked out. But isn't $ qmake -project supposed to add that line (QT += widgets) to the pro file? How could I know beforehand that QT += widgets was needed in the code in question:

        // helloWorld/main.cpp
        #include <QtWidgets/QApplication>
        #include <QtWidgets/QLabel>
        int main(int argc, char *argv[])
        {
          QApplication a(argc, argv);
          QLabel label("Hello World");
          label.show();
          return a.exec();
        }
        

        It's not mentioned in the book either. Could it be because the book was printed on 2007 and the Qt I'm using is version 2015? Thanks.

        kshegunovK 1 Reply Last reply
        0
        • G Gazette

          Thank you, it worked out. But isn't $ qmake -project supposed to add that line (QT += widgets) to the pro file? How could I know beforehand that QT += widgets was needed in the code in question:

          // helloWorld/main.cpp
          #include <QtWidgets/QApplication>
          #include <QtWidgets/QLabel>
          int main(int argc, char *argv[])
          {
            QApplication a(argc, argv);
            QLabel label("Hello World");
            label.show();
            return a.exec();
          }
          

          It's not mentioned in the book either. Could it be because the book was printed on 2007 and the Qt I'm using is version 2015? Thanks.

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by kshegunov
          #4

          @Gazette
          Hello,
          In Qt5 the widgets were pulled from the GUI module, and have been put in their own widgets module. That's why you need to add the widgets in your project file. Note how you include the headers: #include <QtWidgets/...> ;)
          By default qmake will add the core and gui modules only. And you know what module you need from the documentation, see the second line in the table that states: qmake: QT += widgets?

          Kind regards.

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply
          1

          • Login

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