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. BUG. Qt 5.0.2, Windows 32-bit, MinGW 4.7
Qt 6.11 is out! See what's new in the release blog

BUG. Qt 5.0.2, Windows 32-bit, MinGW 4.7

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 5.7k 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.
  • T Offline
    T Offline
    test2013
    wrote on last edited by
    #1

    This example code from Max Schlee's Qt-book not comliling.

    @/* ======================================================================
    ** main.cpp
    ** ======================================================================
    **
    ** ======================================================================
    ** Copyright (c) 2007 by Max Schlee
    ** ======================================================================
    */

    #include <QtGui>
    #include "Counter.h"

    // ----------------------------------------------------------------------
    int main (int argc, char** argv)
    {
    QApplication app(argc, argv);

    QLabel      lbl("0");
    QPushButton cmd&#40;"ADD"&#41;;
    Counter     counter;
    
    lbl.show(&#41;;
    cmd.show(&#41;;
    
    QObject::connect(&cmd, SIGNAL(clicked()), 
                     &counter, SLOT(slotInc())
                    );
    
    QObject::connect(&counter, SIGNAL(counterChanged(int)),
                     &lbl, SLOT(setNum(int))
                    );
    
    QObject::connect(&counter, SIGNAL(goodbye()), 
                     &app, SLOT(quit())
                    );
    
    return app.exec&#40;&#41;;
    

    }
    @

    IDE says:
    @main.cpp:-1: In function 'int qMain(int, char**)':
    main.cpp:16: error: variable 'QApplication app' has initializer but incomplete type
    main.cpp:18: error: 'QLabel' was not declared in this scope
    main.cpp:18: error: expected ';' before 'lbl'
    main.cpp:19: error: 'QPushButton' was not declared in this scope
    main.cpp:19: error: expected ';' before 'cmd'
    main.cpp:22: error: 'lbl' was not declared in this scope
    main.cpp:23: error: 'cmd' was not declared in this scope
    main.cpp:38: warning: control reaches end of non-void function [-Wreturn-type]
    @

    I had same-like problem with "Hello World" project. At that time the problem was solved by replacing
    @#include <QtGui>@

    To
    @#include <QApplication>
    #include <QLabel>@

    But now it did not help. I tried to recompile "Hello World" project with "#include <QtGui>" and it is going. What's the problem? Random bug?

    -- UPD --

    OS Windows 7 Pro SP1, x64.
    Qt build: "Qt 5.0.2, Windows 32-bit, MinGW 4.7":http://download.qt-project.org/official_releases/qt/5.0/5.0.2/qt-windows-opensource-5.0.2-mingw47_32-x86-offline.exe
    Qt build installation settings: default.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      b1gsnak3
      wrote on last edited by
      #2

      Not a bug... Just add QT += widgets to your PRO file and #include <QtWidgets> instead of QtGui

      1 Reply Last reply
      0
      • N Offline
        N Offline
        Near3
        wrote on last edited by
        #3

        Ignore this.

        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