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. Error while making example file
Qt 6.11 is out! See what's new in the release blog

Error while making example file

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 5 Posters 3.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.
  • F Offline
    F Offline
    ferocito
    wrote on last edited by ferocito
    #1

    Hey,
    I need to use Qt for a school project, so I downloaded the 6.4.2 version and tried to build the example project the teacher gave us, but I struggled with this error :

    ./glwidget.h:3:10: fatal error: 'QOpenGLWidget' file not found
    

    Note that the error is related to a

    #include  <QOpenGLWidget>  
    

    in a .h file of the project.

    I succeed to resolve this error by adding

    INCLUDEPATH += /path/to/header/file
    

    to the .pro file, but another error came up :

    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1
    

    I tried to add this (with ChatGPT help) on the .pro file :

    QMAKE_MACOSX_DEPLOYMENT_TARGET = 12.5
    QMAKE_APPLE_DEVICE_ARCHS = arm64
    LIBS += -framework QtWidgets -framework QtOpenGL
    

    but it didn't change anything...

    When changing arm64 to x86_64, same error :

    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1
    

    In my despair, I tried to build one of the examples the 6.4.2 Qt version provides :

    cd /path/to/Qt/examples/6.4.2/widgets/tools/plugandpaint/app
    qmake
    make -config release
    

    And as i was expecting, another error :

    ld: library not found for -lpnp_basictools
    clang: error: linker command failed with exit code 1
    

    I have

    QT += openglwidgets
    

    in my .pro file, so the problem is not related to this.

    After hours spent on ChatGPT and hours trying to explain my problem to the course assistants, this forum is my last hope before resetting my Mac.

    If this can help, I'm on a M2 Macbook Air, version 12.5.

    Thank you if you made it this far, hope someone will be able to help me.

    jsulmJ C 2 Replies Last reply
    0
    • F ferocito

      Hey,
      I need to use Qt for a school project, so I downloaded the 6.4.2 version and tried to build the example project the teacher gave us, but I struggled with this error :

      ./glwidget.h:3:10: fatal error: 'QOpenGLWidget' file not found
      

      Note that the error is related to a

      #include  <QOpenGLWidget>  
      

      in a .h file of the project.

      I succeed to resolve this error by adding

      INCLUDEPATH += /path/to/header/file
      

      to the .pro file, but another error came up :

      ld: symbol(s) not found for architecture arm64
      clang: error: linker command failed with exit code 1
      

      I tried to add this (with ChatGPT help) on the .pro file :

      QMAKE_MACOSX_DEPLOYMENT_TARGET = 12.5
      QMAKE_APPLE_DEVICE_ARCHS = arm64
      LIBS += -framework QtWidgets -framework QtOpenGL
      

      but it didn't change anything...

      When changing arm64 to x86_64, same error :

      ld: symbol(s) not found for architecture x86_64
      clang: error: linker command failed with exit code 1
      

      In my despair, I tried to build one of the examples the 6.4.2 Qt version provides :

      cd /path/to/Qt/examples/6.4.2/widgets/tools/plugandpaint/app
      qmake
      make -config release
      

      And as i was expecting, another error :

      ld: library not found for -lpnp_basictools
      clang: error: linker command failed with exit code 1
      

      I have

      QT += openglwidgets
      

      in my .pro file, so the problem is not related to this.

      After hours spent on ChatGPT and hours trying to explain my problem to the course assistants, this forum is my last hope before resetting my Mac.

      If this can help, I'm on a M2 Macbook Air, version 12.5.

      Thank you if you made it this far, hope someone will be able to help me.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @ferocito said in Error while making example file:

      QOpenGLWidget

      It should be enough to add

      QT += openglwidgets
      

      to your pro file like shown in https://doc.qt.io/qt-6/qopenglwidget.html

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

      F 1 Reply Last reply
      0
      • jsulmJ jsulm

        @ferocito said in Error while making example file:

        QOpenGLWidget

        It should be enough to add

        QT += openglwidgets
        

        to your pro file like shown in https://doc.qt.io/qt-6/qopenglwidget.html

        F Offline
        F Offline
        ferocito
        wrote on last edited by ferocito
        #3

        @jsulm Hey! Thank you for your response, I already have
        QT += openglwidgets in my .pro file, that's why this error surprises me...

        SGaistS 1 Reply Last reply
        0
        • F ferocito

          @jsulm Hey! Thank you for your response, I already have
          QT += openglwidgets in my .pro file, that's why this error surprises me...

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @ferocito hi,

          Did you check that the Qt version you use is a universal build ?

          Did you use the online installer to install it ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          F 2 Replies Last reply
          0
          • SGaistS SGaist

            @ferocito hi,

            Did you check that the Qt version you use is a universal build ?

            Did you use the online installer to install it ?

            F Offline
            F Offline
            ferocito
            wrote on last edited by ferocito
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • SGaistS SGaist

              @ferocito hi,

              Did you check that the Qt version you use is a universal build ?

              Did you use the online installer to install it ?

              F Offline
              F Offline
              ferocito
              wrote on last edited by
              #6

              @SGaist Hey! Yes I used the online installer to install it.
              I juste reinstalled the 6.4.2 version and I made sure in the online installer that it was the universal build, but the error's still here...

              JonBJ 1 Reply Last reply
              0
              • jsulmJ jsulm referenced this topic on
              • F ferocito

                @SGaist Hey! Yes I used the online installer to install it.
                I juste reinstalled the 6.4.2 version and I made sure in the online installer that it was the universal build, but the error's still here...

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by JonB
                #7

                @ferocito
                I don't know, but https://doc.qt.io/qt-6/qtopengl-index.html#building-with-qmake documenting changes from Qt 5 to 6 says you need:

                QT += opengl
                

                Try that as well as/instead of QT += openglwidgets, any help? Don't forget to re-run qmake when changing the .pro file!

                F 1 Reply Last reply
                0
                • JonBJ JonB

                  @ferocito
                  I don't know, but https://doc.qt.io/qt-6/qtopengl-index.html#building-with-qmake documenting changes from Qt 5 to 6 says you need:

                  QT += opengl
                  

                  Try that as well as/instead of QT += openglwidgets, any help? Don't forget to re-run qmake when changing the .pro file!

                  F Offline
                  F Offline
                  ferocito
                  wrote on last edited by
                  #8

                  @JonB Still the same error... A friend tried to do the same routine as mine on his mac, and same errors too...

                  SGaistS F 2 Replies Last reply
                  0
                  • F ferocito

                    @JonB Still the same error... A friend tried to do the same routine as mine on his mac, and same errors too...

                    SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Can you provide a minimal example that triggers this error ?

                    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
                    • F ferocito

                      @JonB Still the same error... A friend tried to do the same routine as mine on his mac, and same errors too...

                      F Offline
                      F Offline
                      ferocito
                      wrote on last edited by ferocito
                      #10

                      @ferocito When running any type of project...

                      The last error i mentioned in my post comes from an example project directly provided by Qt and findable at

                      /Users/{UserName}/Qt/Examples/Qt-6.4.2/widgets/tools/plugandpaint
                      

                      However, when i create a simple project with just an empty window, it works perfectly...

                      1 Reply Last reply
                      0
                      • F ferocito

                        Hey,
                        I need to use Qt for a school project, so I downloaded the 6.4.2 version and tried to build the example project the teacher gave us, but I struggled with this error :

                        ./glwidget.h:3:10: fatal error: 'QOpenGLWidget' file not found
                        

                        Note that the error is related to a

                        #include  <QOpenGLWidget>  
                        

                        in a .h file of the project.

                        I succeed to resolve this error by adding

                        INCLUDEPATH += /path/to/header/file
                        

                        to the .pro file, but another error came up :

                        ld: symbol(s) not found for architecture arm64
                        clang: error: linker command failed with exit code 1
                        

                        I tried to add this (with ChatGPT help) on the .pro file :

                        QMAKE_MACOSX_DEPLOYMENT_TARGET = 12.5
                        QMAKE_APPLE_DEVICE_ARCHS = arm64
                        LIBS += -framework QtWidgets -framework QtOpenGL
                        

                        but it didn't change anything...

                        When changing arm64 to x86_64, same error :

                        ld: symbol(s) not found for architecture x86_64
                        clang: error: linker command failed with exit code 1
                        

                        In my despair, I tried to build one of the examples the 6.4.2 Qt version provides :

                        cd /path/to/Qt/examples/6.4.2/widgets/tools/plugandpaint/app
                        qmake
                        make -config release
                        

                        And as i was expecting, another error :

                        ld: library not found for -lpnp_basictools
                        clang: error: linker command failed with exit code 1
                        

                        I have

                        QT += openglwidgets
                        

                        in my .pro file, so the problem is not related to this.

                        After hours spent on ChatGPT and hours trying to explain my problem to the course assistants, this forum is my last hope before resetting my Mac.

                        If this can help, I'm on a M2 Macbook Air, version 12.5.

                        Thank you if you made it this far, hope someone will be able to help me.

                        C Offline
                        C Offline
                        ChrisW67
                        wrote on last edited by
                        #11

                        The plug and Paint example should be built from this folder
                        /path/to/Qt/examples/6.4.2/widgets/tools/plugandpaint
                        not
                        /path/to/Qt/examples/6.4.2/widgets/tools/plugandpaint/app

                        Using the latter folder will not build the plugin libraries, one of which is the subject of the complaint:

                        ld: library not found for -lpnp_basictools
                        clang: error: linker command failed with exit code 1
                        
                        F 1 Reply Last reply
                        0
                        • C ChrisW67

                          The plug and Paint example should be built from this folder
                          /path/to/Qt/examples/6.4.2/widgets/tools/plugandpaint
                          not
                          /path/to/Qt/examples/6.4.2/widgets/tools/plugandpaint/app

                          Using the latter folder will not build the plugin libraries, one of which is the subject of the complaint:

                          ld: library not found for -lpnp_basictools
                          clang: error: linker command failed with exit code 1
                          
                          F Offline
                          F Offline
                          ferocito
                          wrote on last edited by ferocito
                          #12

                          @ChrisW67 I did this and still the same error...

                          I searched the "lpnp_basictools" library in my computer, and i didn't find it. Maybe Qt doesn't find this library because it simply doesn't exist on my computer.

                          It's weird because I installed Qt with the Qt online installer...

                          Maybe one thing that can help : I only installed the MacOS version, and didn't install the IOS modules (they weight 17 GB and I don't need to make apps for IOS).

                          However, I tried to build and run another example :

                          /path/to/Qt/Examples/Qt-6.4.2/statemachine
                          

                          and it works perfectly.

                          It's weird because the example my teacher gave me is a simple colored triangle display, without any animation and interaction, and I can't run it, while the statemachine example seems way more complicated, with interaction and animations...

                          jsulmJ 1 Reply Last reply
                          0
                          • F ferocito

                            @ChrisW67 I did this and still the same error...

                            I searched the "lpnp_basictools" library in my computer, and i didn't find it. Maybe Qt doesn't find this library because it simply doesn't exist on my computer.

                            It's weird because I installed Qt with the Qt online installer...

                            Maybe one thing that can help : I only installed the MacOS version, and didn't install the IOS modules (they weight 17 GB and I don't need to make apps for IOS).

                            However, I tried to build and run another example :

                            /path/to/Qt/Examples/Qt-6.4.2/statemachine
                            

                            and it works perfectly.

                            It's weird because the example my teacher gave me is a simple colored triangle display, without any animation and interaction, and I can't run it, while the statemachine example seems way more complicated, with interaction and animations...

                            jsulmJ Offline
                            jsulmJ Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            @ferocito said in Error while making example file:

                            I searched the "lpnp_basictools" library in my computer, and i didn't find it

                            The name of the library should be: libpnp_basictools.so.*
                            -lpnp_basictools means: -l is the parameter telling linker to link libpnp_basictools.so library.

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

                            F 1 Reply Last reply
                            0
                            • jsulmJ jsulm

                              @ferocito said in Error while making example file:

                              I searched the "lpnp_basictools" library in my computer, and i didn't find it

                              The name of the library should be: libpnp_basictools.so.*
                              -lpnp_basictools means: -l is the parameter telling linker to link libpnp_basictools.so library.

                              F Offline
                              F Offline
                              ferocito
                              wrote on last edited by
                              #14

                              @jsulm Can't find this file in my computer.

                              C 1 Reply Last reply
                              0
                              • F ferocito

                                @jsulm Can't find this file in my computer.

                                C Offline
                                C Offline
                                ChrisW67
                                wrote on last edited by ChrisW67
                                #15

                                @ferocito The file is built as one of the plugins in the Plug & Paint example.
                                The example code is here and the specific sub-project that builds the library is at plugins/basictools/basictools.pro

                                $ cd ~/Qt/Examples/Qt-6.4.2/widgets/tools/plugandpaint
                                $ qmake
                                $ make
                                ...
                                $ ls -F . plugins
                                .:
                                app/  CMakeLists.txt  Makefile  plugandpaint*  plugandpaint.pro  plugins/
                                
                                plugins:
                                basictools/  CMakeLists.txt  extrafilters/  libpnp_basictools.a  libpnp_extrafilters.so*  Makefile  plugins.pro
                                
                                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