Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. QApplication, QLabel : no such file or directory
QtWS25 Last Chance

QApplication, QLabel : no such file or directory

Scheduled Pinned Locked Moved Solved Installation and Deployment
qapplicationqlabel
10 Posts 5 Posters 3.1k Views
  • 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
    Genne
    wrote on last edited by Genne
    #1

    Hello,

    I'm a QT beginner. I have been trying to execute below code. But I continuously get 'QApplication and QLabel : no such file or directory' error. I referred to a couple of past posts and tried but failed. Can someone help me with this issue?
    I have also added "QT += widgets, core gui" to .pro file.
    Thank you

    #include <QtWidgets/QApplication>
    #include <QtGui/QLabel>
    #include <QPixmap>
    
    int main(int argc, char** argv){
    	QApplication app(argc, argv);
    	QLabel* lb = new QLabel("", 0);
    	
    	lb->setPixmap(QPixmap("bali.jpg"));
    	lb->show();
    	
    	return app.exec();
    }
    
    JonBJ jsulmJ 2 Replies Last reply
    0
    • SGaistS SGaist

      Hi,

      @Genne said in QApplication, QLabel : no such file or directory:

      QT += widgets, core gui

      There's a comma after widgets. Is it a typo here or do you also have that in your .pro file ?

      G Offline
      G Offline
      Genne
      wrote on last edited by
      #9

      @SGaist

      I meant 2 separate lines.

      QT += core gui
      QT += widgets

      I think I had a wrong PATH set up. I changed the PATH. Now it works fine. Thank you all your help!

      1 Reply Last reply
      0
      • G Genne

        Hello,

        I'm a QT beginner. I have been trying to execute below code. But I continuously get 'QApplication and QLabel : no such file or directory' error. I referred to a couple of past posts and tried but failed. Can someone help me with this issue?
        I have also added "QT += widgets, core gui" to .pro file.
        Thank you

        #include <QtWidgets/QApplication>
        #include <QtGui/QLabel>
        #include <QPixmap>
        
        int main(int argc, char** argv){
        	QApplication app(argc, argv);
        	QLabel* lb = new QLabel("", 0);
        	
        	lb->setPixmap(QPixmap("bali.jpg"));
        	lb->show();
        	
        	return app.exec();
        }
        
        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #2

        @Genne

        #include <QApplication>
        #include <QLabel>
        #include <QPixmap>
        

        Plain names in the #includes, not those sub-directories.

        G 1 Reply Last reply
        2
        • G Genne

          Hello,

          I'm a QT beginner. I have been trying to execute below code. But I continuously get 'QApplication and QLabel : no such file or directory' error. I referred to a couple of past posts and tried but failed. Can someone help me with this issue?
          I have also added "QT += widgets, core gui" to .pro file.
          Thank you

          #include <QtWidgets/QApplication>
          #include <QtGui/QLabel>
          #include <QPixmap>
          
          int main(int argc, char** argv){
          	QApplication app(argc, argv);
          	QLabel* lb = new QLabel("", 0);
          	
          	lb->setPixmap(QPixmap("bali.jpg"));
          	lb->show();
          	
          	return app.exec();
          }
          
          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #3

          @Genne Documentation tells you what to include.
          For example https://doc.qt.io/qt-5/qapplication.html

          #include <QApplication>
          

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          G 1 Reply Last reply
          1
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #4

            Hi and welcome to the forums

            If you see older examples for Qt, sometimes the includes are no longer valid.
            Often you can just remove first part of it
            #include <QtWidgets/QApplication>
            --->
            #include <QApplication>

            and then it works.

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

              Hi,

              @Genne said in QApplication, QLabel : no such file or directory:

              QT += widgets, core gui

              There's a comma after widgets. Is it a typo here or do you also have that in 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

              mrjjM G 2 Replies Last reply
              2
              • SGaistS SGaist

                Hi,

                @Genne said in QApplication, QLabel : no such file or directory:

                QT += widgets, core gui

                There's a comma after widgets. Is it a typo here or do you also have that in your .pro file ?

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #6

                @SGaist
                The hawkeye :)

                1 Reply Last reply
                0
                • JonBJ JonB

                  @Genne

                  #include <QApplication>
                  #include <QLabel>
                  #include <QPixmap>
                  

                  Plain names in the #includes, not those sub-directories.

                  G Offline
                  G Offline
                  Genne
                  wrote on last edited by
                  #7
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @Genne Documentation tells you what to include.
                    For example https://doc.qt.io/qt-5/qapplication.html

                    #include <QApplication>
                    
                    G Offline
                    G Offline
                    Genne
                    wrote on last edited by
                    #8

                    @jsulm said in QApplication, QLabel : no such file or directory:

                    @Genne Documentation tells you what to include.
                    For example https://doc.qt.io/qt-5/qapplication.html

                    #include <QApplication>
                    

                    I should definitely read it thru. Thank you for the reply

                    1 Reply Last reply
                    0
                    • SGaistS SGaist

                      Hi,

                      @Genne said in QApplication, QLabel : no such file or directory:

                      QT += widgets, core gui

                      There's a comma after widgets. Is it a typo here or do you also have that in your .pro file ?

                      G Offline
                      G Offline
                      Genne
                      wrote on last edited by
                      #9

                      @SGaist

                      I meant 2 separate lines.

                      QT += core gui
                      QT += widgets

                      I think I had a wrong PATH set up. I changed the PATH. Now it works fine. Thank you all your help!

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

                        PATH ? Why did you change that environment variable manually ?

                        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
                        1

                        • Login

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