Problem with sample program



  • Hello,

    I just learn C++ and I read a book about it.
    Now, I am at the chapter about QT and this sample doesn't work:

    ´´´
    #include <QtWidgets/QApplication>
    #include <QtWidgets/QLabel>
    #include <iostream>

    class MeinLabel : public QLabel
    {
    public:
    MeinLabel(const char *text) : QLabel(text)
    {
    }

    ~MeinLabel()
    {
        std::cout << "Destruktor ~MeinLabel gerufen!" << std::endl;
    }
    

    };

    int main(int argc, char *argv[])
    {
    QApplication application(argc, argv);
    MeinLabel *mlabel = new MeinLabel("Erstes Qt-Programm");
    mlabel->show();

    delete mlabel;
    return application.exec();
    

    }
    ´´´

    Why?

    QT Creator show me 59 errors.

    Sorry for my bad english.



  • @Gravak

    Hi,

    The errors Qt creators shows are from your C++ compiler. The errors contain useful information about what is not working. You need to post those errors here before anyone can help you.

    Greetings,

    t3685



  • Problem solved.

    The Qt Project file was empty.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.