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. Qt cannot build and run "Boxes" example
Forum Updated to NodeBB v4.3 + New Features

Qt cannot build and run "Boxes" example

Scheduled Pinned Locked Moved Solved General and Desktop
28 Posts 3 Posters 6.6k 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.
  • H Offline
    H Offline
    Hassan-math
    wrote on last edited by
    #1

    Hi all,

    I'm new in Qt. I wanted to run the "boxes" example to check Qt OpenGL. However, I got this error:

    Project ERROR: This example requires Qt to be configured with -opengl desktop
    

    any idea?

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

      hi
      What Qt version are you using? and which platform.

      In the newer version of Qt this should be automatic.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        Hassan-math
        wrote on last edited by
        #3

        Hi @mrjj

        I have two versions of Qt Creator:
        Qt Creator 5.0.0 rc1 Community
        Qt Creator 4.14.4 Community

        Also, I have some kits that some are for VS2019 and some for Qt (as far as I know), these are the available kits:

        Desktop Qt 5.12.10 MSVC2015 64bit (There is a warning message beside it)
        Desktop Qt 5.12.10 MSVC2017 32bit (There is a warning message beside it)
        Desktop Qt 5.12.10 MSVC2017 64bit (There is a warning message beside it)

        Desktop Qt 5.12.10 MinGW 32-bit
        Desktop Qt 5.12.10 MinGW 64-bit (default)
        Desktop Qt 5.15.2 MSVC2019 64bit (There is a warning message beside it)
        Desktop Qt 5.15.2 MinGW 32-bit
        Desktop Qt 5.15.2 MinGW 64-bit

        Qt 5.12.10 for UWP 32bit (MSVC 2017) (There is a warning message beside it)
        Qt 5.12.10 for UWP 64bit (MSVC 2015) (There is a window icon beside it)
        Qt 5.12.10 for UWP 64bit (MSVC 2017) (There is a window icon beside it)

        Qt 5.12.10 for UWP ARMv7 (MSVC 2015) (There is a warning message beside it)
        Qt 5.12.10 for UWP ARMv7 (MSVC 2017) (There is a warning message beside it)
        Qt 5.15.2 WebAssembly
        Qt 5.15.2 for UWP 32bit (MSVC 2019) (There is a warning message beside it)
        Qt 5.15.2 for UWP 64bit (MSVC 2019) (There is a warning message beside it)
        Qt 5.15.2 for UWP ARMv7 (MSVC 2019) (There is a warning message beside it)

        Depend on which kit I choose, I get different errors. By default I choose "Desktop Qt 5.12.10 MinGW 64-bit (default)" and I get:

        error: Project ERROR: Cannot run compiler 'cl'. Output:
        ===================
        ===================
        Maybe you forgot to setup the environment?
        
        
        C:\Qt\Examples\Qt-5.12.10\widgets\graphicsview\boxes\boxes.pro:-1: error: Error while parsing file C:\Qt\Examples\Qt-5.12.10\widgets\graphicsview\boxes\boxes.pro. Giving up.
        

        When I choose "Desktop Qt 5.12.10 MinGW 64-bit", I get:

        Project ERROR: This example requires Qt to be configured with -opengl desktop
        

        There is another thing maybe it worth mentioning. When I open Qt creator, a window pops up "Plugin loader messages" and it says "following plugins have errors and cannot be loaded":

        UpdateInfo
        

        in the "details" section I have:

        Plugin initialization failed: The maintenance tool at "C:\Qt/MaintenanceTool.exe" is not an executable. Check your installation.
        
        1 Reply Last reply
        0
        • C Offline
          C Offline
          ChrisW67
          wrote on last edited by
          #4

          @Hassan-math said in Qt cannot build and run "Boxes" example:

          Depend on which kit I choose, I get different errors. By default I choose "Desktop Qt 5.12.10 MinGW 64-bit (default)" and I get:
          error: Project ERROR: Cannot run compiler 'cl'. Output:
          = ==================
          = ==================
          Maybe you forgot to setup the environment?

          cl.exe is the compiler from Microsoft Visual C++. If your project was constructed with the MingW build kit then the compiler would be g++. Clean out the build directory (I assume you are using a shadow build and not building in-source), rerun qmake from the correct kit, and then try again.

          If you do not have the Microsoft VC compilers installed then I suggest removing the kits entirely. I suspect that, even with the Microsoft dev environment installed, none of the UWP options will support OpenGL.

          1 Reply Last reply
          0
          • H Offline
            H Offline
            Hassan-math
            wrote on last edited by Hassan-math
            #5

            @ChrisW67 , I did clean the build directory and unchecked the shadow build. But I got same error:

            error: Project ERROR: Cannot run compiler 'cl'. Output:
            = ==================
            = ==================
            Maybe you forgot to setup the environment?
            

            P.S: I have already installed VS2019 and I think Qt has detected those compilers and listed them in the kits.

            1 Reply Last reply
            0
            • C Offline
              C Offline
              ChrisW67
              wrote on last edited by
              #6

              If you are trying to build with an MSVC kit then you need to ensure that the environment is correct for MSVC. IIRC there is some stone age batch file that sets up a bucket of environment variable (vcvars64.bat perhaps). Launch Qt Creator from that environment.

              1 Reply Last reply
              0
              • H Offline
                H Offline
                Hassan-math
                wrote on last edited by
                #7

                No, I have used "Desktop Qt 5.12.10 MinGW 64-bit" kit

                mrjjM 1 Reply Last reply
                0
                • H Hassan-math

                  No, I have used "Desktop Qt 5.12.10 MinGW 64-bit" kit

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

                  @Hassan-math

                  Hi
                  Can you run any of the other included examples ? (not openGL)

                  If you use mingw kit and it asks for visual studio cl.exe then something is wrong with the setup so
                  i wonder if it works at all ?
                  (Not talking about boxes - just a hello world program )

                  1 Reply Last reply
                  0
                  • H Offline
                    H Offline
                    Hassan-math
                    wrote on last edited by
                    #9

                    @mrjj ,
                    Yes, I can run other examples even those tagged by "OpenGL". However, none of those examples have

                    Qt += OpenGL
                    

                    in their pro file. I think the problem is related to the Qt OpenGL.

                    mrjjM 1 Reply Last reply
                    0
                    • H Hassan-math

                      @mrjj ,
                      Yes, I can run other examples even those tagged by "OpenGL". However, none of those examples have

                      Qt += OpenGL
                      

                      in their pro file. I think the problem is related to the Qt OpenGL.

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

                      Hi
                      ok so so other examples works.

                      Yes then something is up when you try to use that module.

                      I assume you on a full PC Desktop device since you also talk Visual Studio.

                      https://forum.qt.io/topic/81931/project-error-this-example-requires-qt-to-be-configured-with-opengl-desktop

                      SO bascially it seems it thinks you dont have full stack openGL.

                      1 Reply Last reply
                      0
                      • H Offline
                        H Offline
                        Hassan-math
                        wrote on last edited by
                        #11

                        Hi,
                        I think so. How can I get full stack OpenGL on Qt?

                        mrjjM 1 Reply Last reply
                        0
                        • H Hassan-math

                          Hi,
                          I think so. How can I get full stack OpenGL on Qt?

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

                          @Hassan-math

                          Hi. You should have that on Desktop PC.

                          Can you run games etc on it ?

                          What is the graphics card `?

                          1 Reply Last reply
                          0
                          • H Offline
                            H Offline
                            Hassan-math
                            wrote on last edited by
                            #13

                            @mrjj
                            Hi,
                            I have an HP laptop with a Radeon Graphic card. I can run games and also I have tested OpenGL in other platforms such as VS2019 and even Python OpenGL. It works perfectly.

                            mrjjM 1 Reply Last reply
                            0
                            • H Hassan-math

                              @mrjj
                              Hi,
                              I have an HP laptop with a Radeon Graphic card. I can run games and also I have tested OpenGL in other platforms such as VS2019 and even Python OpenGL. It works perfectly.

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

                              @Hassan-math

                              Ok. then the setup must be messed up somehow.

                              Did you mean to install ALL the Qt packages for both mingw and visual studio and ARM and UWP etc?

                              1 Reply Last reply
                              0
                              • H Offline
                                H Offline
                                Hassan-math
                                wrote on last edited by
                                #15

                                I don't remember exactly. But I think I installed MinGW and UWP and Qt hs automatically recognized the VS ones from visual studio.

                                mrjjM 1 Reply Last reply
                                0
                                • H Hassan-math

                                  I don't remember exactly. But I think I installed MinGW and UWP and Qt hs automatically recognized the VS ones from visual studio.

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

                                  @Hassan-math

                                  Ok but do you need all of them ?
                                  Its harder to find out what is wrong with so many kits etc.

                                  Also, it should have worked out of the box with no issues so Im not sure what could be up but the error suggests it thinks
                                  its not Desktop.

                                  Also when you select mingw it should not talk about cl.exe etc so
                                  Im not sure the state of your installation.

                                  If you have the visual studio already installed from MICROSOFT then maybe try uninstall ALL Qt
                                  and then ONLY install the Qt Visual Studio version.
                                  Not all of it.

                                  alt text

                                  Its important to understand that the Qt installer DOES NOT have the compiler included.
                                  Its a manual install and also the debugger.

                                  1 Reply Last reply
                                  0
                                  • H Offline
                                    H Offline
                                    Hassan-math
                                    wrote on last edited by Hassan-math
                                    #17

                                    @mrjj
                                    Thank you for your instruction. The reason I chose all kits to get installed on my machine was that I did not know which kit includes OpenGL! So, I tried all of them.

                                    I'm going to do clean uninstallation of Qt and install it again.

                                    Just to ensure: I should just pick MSVC 2015 64 bit to use OpenGL (as you have shown in the picture)? My project is about physics-based simulation and consists of 3D visualisation, a lot of mathematics (I need Eigen for example) and machine learning. So, If I need to check other options let me know.

                                    My environment is:
                                    Windows 10
                                    I already have Installed VS2019

                                    Thanks!

                                    mrjjM 1 Reply Last reply
                                    0
                                    • H Hassan-math

                                      @mrjj
                                      Thank you for your instruction. The reason I chose all kits to get installed on my machine was that I did not know which kit includes OpenGL! So, I tried all of them.

                                      I'm going to do clean uninstallation of Qt and install it again.

                                      Just to ensure: I should just pick MSVC 2015 64 bit to use OpenGL (as you have shown in the picture)? My project is about physics-based simulation and consists of 3D visualisation, a lot of mathematics (I need Eigen for example) and machine learning. So, If I need to check other options let me know.

                                      My environment is:
                                      Windows 10
                                      I already have Installed VS2019

                                      Thanks!

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

                                      @Hassan-math said in Qt cannot build and run "Boxes" example:

                                      Hi

                                      If you have Vs2019 installed then select the Qt for Vs 2017 64 bit (not 2015 then)
                                      All VS and mingw uses openGL.

                                      but if you need Eigen then I think using visual studio is more fun to than mingw.

                                      Do notice you can use it 2 ways. Either in Creator, the editor that comes with Qt or the VS Editor.
                                      If you want to use VS editor thete is a plugin that makes integration better

                                      If you want to use Creator then be awre to use a debugger, its an extra install as
                                      Creator cant use the one build in the vs editor and need the microsoft debug tools.

                                      On windows VS is often more fun than mingw when wanting to use 3rd party libs.

                                      1 Reply Last reply
                                      0
                                      • H Offline
                                        H Offline
                                        Hassan-math
                                        wrote on last edited by
                                        #19

                                        @mrjj
                                        I'm going to use Creator as editor. So, I'll choose VS2017 64 bit.

                                        Now the problem is that I cannot uninstall QT. The Qt maintenance tool is not working. When I go to the Qt folder there are "MaintenanceTool.exe.new" and "MaintenanceTool.dat.new". Also, using Windows uninstallation is not working as it cannot find "MaintenanceTool.exe:.

                                        How can I remove Qt?

                                        1 Reply Last reply
                                        0
                                        • H Offline
                                          H Offline
                                          Hassan-math
                                          wrote on last edited by Hassan-math
                                          #20

                                          @mrjj
                                          I changed "MaintenanceTool.exe.new" to "MaintenanceTool.exe" and Windows uninstallation works.

                                          Just another question: How can I install a debugger for Creator?

                                          mrjjM 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