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. "No such file or directory" when I switch to Release mode
Forum Updated to NodeBB v4.3 + New Features

"No such file or directory" when I switch to Release mode

Scheduled Pinned Locked Moved Unsolved General and Desktop
14 Posts 5 Posters 3.7k 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.
  • devhobbyD Offline
    devhobbyD Offline
    devhobby
    wrote on last edited by
    #1

    This is my MainWindow.h

    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H
    
    #include <QMainWindow>
    #include <QMediaPlayer>
    
    namespace Ui
    {
        class MainWindow;
    }
    
    class MainWindow : public QMainWindow
    { ... }
    

    The #include<QMediaPlayer> gives an error when compiling in Release mode
    But it compiles and runs fine in Debug mode.

    Why? This is my kit configuration:
    0_1509622250064_123.jpg

    Thanks in advance!

    S J.HilkJ 2 Replies Last reply
    0
    • devhobbyD devhobby

      This is my MainWindow.h

      #ifndef MAINWINDOW_H
      #define MAINWINDOW_H
      
      #include <QMainWindow>
      #include <QMediaPlayer>
      
      namespace Ui
      {
          class MainWindow;
      }
      
      class MainWindow : public QMainWindow
      { ... }
      

      The #include<QMediaPlayer> gives an error when compiling in Release mode
      But it compiles and runs fine in Debug mode.

      Why? This is my kit configuration:
      0_1509622250064_123.jpg

      Thanks in advance!

      S Offline
      S Offline
      Stoyan
      wrote on last edited by
      #2

      @devhobby
      I think you need to copy file "Qt5Multimedia.dll" in your release directory. In Debug mode there is a link to Qt folder with all "*.dll" files, but in Release mode there isn't.

      devhobbyD 1 Reply Last reply
      0
      • mranger90M Offline
        mranger90M Offline
        mranger90
        wrote on last edited by
        #3

        If it is failing to compile then I think we need to see the .pro file.

        1 Reply Last reply
        0
        • devhobbyD devhobby

          This is my MainWindow.h

          #ifndef MAINWINDOW_H
          #define MAINWINDOW_H
          
          #include <QMainWindow>
          #include <QMediaPlayer>
          
          namespace Ui
          {
              class MainWindow;
          }
          
          class MainWindow : public QMainWindow
          { ... }
          

          The #include<QMediaPlayer> gives an error when compiling in Release mode
          But it compiles and runs fine in Debug mode.

          Why? This is my kit configuration:
          0_1509622250064_123.jpg

          Thanks in advance!

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by J.Hilk
          #4

          @devhobby said in "No such file or directory" when I switch to Release mode:

          The #include<QMediaPlayer> gives an error when compiling in Release mode

          Would also be heplfull to see the actual error message, preferably quoted, not abstract.


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          1 Reply Last reply
          0
          • S Stoyan

            @devhobby
            I think you need to copy file "Qt5Multimedia.dll" in your release directory. In Debug mode there is a link to Qt folder with all "*.dll" files, but in Release mode there isn't.

            devhobbyD Offline
            devhobbyD Offline
            devhobby
            wrote on last edited by devhobby
            #5

            @Stoyan @mranger90 @J-Hilk

            Now the program starts in Release mode from the QtCreator IDE, but it doesn't when I double click the .exe manually.

            0_1509626579670_123.jpg

            Maybe I have more dependencies to solve: but which ones???

            jsulmJ J.HilkJ 2 Replies Last reply
            0
            • devhobbyD devhobby

              @Stoyan @mranger90 @J-Hilk

              Now the program starts in Release mode from the QtCreator IDE, but it doesn't when I double click the .exe manually.

              0_1509626579670_123.jpg

              Maybe I have more dependencies to solve: but which ones???

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

              @devhobby Please read http://doc.qt.io/qt-5/windows-deployment.html

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

              1 Reply Last reply
              2
              • devhobbyD devhobby

                @Stoyan @mranger90 @J-Hilk

                Now the program starts in Release mode from the QtCreator IDE, but it doesn't when I double click the .exe manually.

                0_1509626579670_123.jpg

                Maybe I have more dependencies to solve: but which ones???

                J.HilkJ Offline
                J.HilkJ Offline
                J.Hilk
                Moderators
                wrote on last edited by
                #7

                @devhobby ah, qt comes with a small console application that helps you in your deployment efforts:

                windeployqt

                Use that one and in 95% of all case you won't need to copy any dependencies by hand.


                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                devhobbyD 1 Reply Last reply
                2
                • J.HilkJ J.Hilk

                  @devhobby ah, qt comes with a small console application that helps you in your deployment efforts:

                  windeployqt

                  Use that one and in 95% of all case you won't need to copy any dependencies by hand.

                  devhobbyD Offline
                  devhobbyD Offline
                  devhobby
                  wrote on last edited by devhobby
                  #8

                  @J.Hilk
                  Yes I watched a video on YouTube showing this method.

                  But unfortunately I belong to that 5% of cases where it doesn't work.

                  My command line:

                  C:\Users\Me\Documents\QtProjects\build-untitled1-Desktop_Qt_5_9_2_MSVC2017_64bit-Release\release > windeployqt.exe --quick .

                  After I launched this command, my folder now looks like this:

                  0_1509627508011_123.jpg

                  But launching the .exe shows the exact same error... nothing changed...

                  jsulmJ 1 Reply Last reply
                  0
                  • devhobbyD devhobby

                    @J.Hilk
                    Yes I watched a video on YouTube showing this method.

                    But unfortunately I belong to that 5% of cases where it doesn't work.

                    My command line:

                    C:\Users\Me\Documents\QtProjects\build-untitled1-Desktop_Qt_5_9_2_MSVC2017_64bit-Release\release > windeployqt.exe --quick .

                    After I launched this command, my folder now looks like this:

                    0_1509627508011_123.jpg

                    But launching the .exe shows the exact same error... nothing changed...

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

                    @devhobby said in "No such file or directory" when I switch to Release mode:

                    C:\Users\Me\Documents\QtProjects\build-untitled1-Desktop_Qt_5_9_2_MSVC2017_64bit-Release\release > windeployqt.exe --quick

                    Should be

                    C:\Users\Me\Documents\QtProjects\build-untitled1-Desktop_Qt_5_9_2_MSVC2017_64bit-Release\release > windeployqt.exe . --quick
                    

                    You need to pass either the executable or directory containing your executable to windeployqt as described in the link I posted.
                    You can also use http://www.dependencywalker.com/ to check whether any libraries are missing.

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

                    1 Reply Last reply
                    1
                    • devhobbyD Offline
                      devhobbyD Offline
                      devhobby
                      wrote on last edited by devhobby
                      #10

                      @jsulm said in "No such file or directory" when I switch to Release mode:

                      Should be

                      C:\Users\Me\Documents\QtProjects\build-untitled1-Desktop_Qt_5_9_2_MSVC2017_64bit-Release\release > windeployqt.exe . --quick
                      

                      Yes I tried putting the dot before --quick but the result is the same. I don't know why, but the application still fails to start...

                      Dependency Walker tells me this

                      0_1509629911448_1234.jpg

                      And the list continues...

                      Also, why libgcc if I compiled with MSVC2017?

                      jsulmJ 1 Reply Last reply
                      0
                      • devhobbyD devhobby

                        @jsulm said in "No such file or directory" when I switch to Release mode:

                        Should be

                        C:\Users\Me\Documents\QtProjects\build-untitled1-Desktop_Qt_5_9_2_MSVC2017_64bit-Release\release > windeployqt.exe . --quick
                        

                        Yes I tried putting the dot before --quick but the result is the same. I don't know why, but the application still fails to start...

                        Dependency Walker tells me this

                        0_1509629911448_1234.jpg

                        And the list continues...

                        Also, why libgcc if I compiled with MSVC2017?

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

                        @devhobby Is it possible that you copied Qt5Multimedia from MinGW Qt?
                        Maybe you should delete the build folder, rerun qmake and build again (after checking that you're using the correct Kit).
                        Also which windeployqt.exe did you use? You should call it using an absolute path to make sure you're using the correct one.

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

                        devhobbyD 1 Reply Last reply
                        0
                        • jsulmJ jsulm

                          @devhobby Is it possible that you copied Qt5Multimedia from MinGW Qt?
                          Maybe you should delete the build folder, rerun qmake and build again (after checking that you're using the correct Kit).
                          Also which windeployqt.exe did you use? You should call it using an absolute path to make sure you're using the correct one.

                          devhobbyD Offline
                          devhobbyD Offline
                          devhobby
                          wrote on last edited by devhobby
                          #12

                          @jsulm said in "No such file or directory" when I switch to Release mode:

                          @devhobby Is it possible that you copied Qt5Multimedia from MinGW Qt?
                          Maybe you should delete the build folder, rerun qmake and build again (after checking that you're using the correct Kit).
                          Also which windeployqt.exe did you use? You should call it using an absolute path to make sure you're using the correct one.

                          I deleted the build folder and re-built the project from QtCreator.
                          Then I ran windeployqt, but this time I didn't copy-paste anything manually

                          And it worked...
                          Previously, I had copied and pasted some .dlls manually from Qt's bin folder.

                          Right now the application runs and works perfectly.

                          I'm afraid I'll have similar problems in the future, so a couple of questions to prevent any issue from happening:

                          • Will the use of windeploy.exe work everytime I want to deploy any Qt dekstop applicaton to Windows?
                          • If not, what should I do? Dependency Walker seems to be confusing most of the times
                          • In the actual release folder, is there something I can delete to reduce the overall program size?
                          • On the link you gave me initially there is Static Linking. When should I use it?
                          jsulmJ J.HilkJ 2 Replies Last reply
                          0
                          • devhobbyD devhobby

                            @jsulm said in "No such file or directory" when I switch to Release mode:

                            @devhobby Is it possible that you copied Qt5Multimedia from MinGW Qt?
                            Maybe you should delete the build folder, rerun qmake and build again (after checking that you're using the correct Kit).
                            Also which windeployqt.exe did you use? You should call it using an absolute path to make sure you're using the correct one.

                            I deleted the build folder and re-built the project from QtCreator.
                            Then I ran windeployqt, but this time I didn't copy-paste anything manually

                            And it worked...
                            Previously, I had copied and pasted some .dlls manually from Qt's bin folder.

                            Right now the application runs and works perfectly.

                            I'm afraid I'll have similar problems in the future, so a couple of questions to prevent any issue from happening:

                            • Will the use of windeploy.exe work everytime I want to deploy any Qt dekstop applicaton to Windows?
                            • If not, what should I do? Dependency Walker seems to be confusing most of the times
                            • In the actual release folder, is there something I can delete to reduce the overall program size?
                            • On the link you gave me initially there is Static Linking. When should I use it?
                            jsulmJ Offline
                            jsulmJ Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            @devhobby

                            • Nobody can guarantee this especially if you're using any third party libraries
                            • You should find out what is missing, for example using Dependency Walker
                            • You can delete everything not needed, it depends what is in the build directory. For example you can delete all object files (*.obj)
                            • Statically linked libraries are used to create an executable which does not depend on shared libraries (all static dependencies are put into the executable). You should not use it if you don't really know what you're doing as you would need to build Qt and all dependencies by yourself! And IMPORTANT: using statically built Qt requires you either to buy a commercial Qt license or release your software under an open source license!

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

                            1 Reply Last reply
                            2
                            • devhobbyD devhobby

                              @jsulm said in "No such file or directory" when I switch to Release mode:

                              @devhobby Is it possible that you copied Qt5Multimedia from MinGW Qt?
                              Maybe you should delete the build folder, rerun qmake and build again (after checking that you're using the correct Kit).
                              Also which windeployqt.exe did you use? You should call it using an absolute path to make sure you're using the correct one.

                              I deleted the build folder and re-built the project from QtCreator.
                              Then I ran windeployqt, but this time I didn't copy-paste anything manually

                              And it worked...
                              Previously, I had copied and pasted some .dlls manually from Qt's bin folder.

                              Right now the application runs and works perfectly.

                              I'm afraid I'll have similar problems in the future, so a couple of questions to prevent any issue from happening:

                              • Will the use of windeploy.exe work everytime I want to deploy any Qt dekstop applicaton to Windows?
                              • If not, what should I do? Dependency Walker seems to be confusing most of the times
                              • In the actual release folder, is there something I can delete to reduce the overall program size?
                              • On the link you gave me initially there is Static Linking. When should I use it?
                              J.HilkJ Offline
                              J.HilkJ Offline
                              J.Hilk
                              Moderators
                              wrote on last edited by
                              #14

                              @devhobby to add to @jsulm , you run the deployment tool directly inside your release folder. That folder contains all kinds of temporary files (moc files and obj files mostly).

                              Just take your *.exe file copy it in a fresh and empty folder and run windeployqt on that file, so you don't have to worry - too much - about unneeded files.


                              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                              Q: What's that?
                              A: It's blue light.
                              Q: What does it do?
                              A: It turns blue.

                              1 Reply Last reply
                              2

                              • Login

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