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. Launching app outside of Creator?

Launching app outside of Creator?

Scheduled Pinned Locked Moved Installation and Deployment
32 Posts 4 Posters 18.9k 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.
  • mzimmersM Offline
    mzimmersM Offline
    mzimmers
    wrote on last edited by
    #1

    Hi -

    I've been using Creator as an IDE for awhile now (on my Mac platform). I've always launched the app from within Creator.

    I recently moved the project to a Windows system...builds and runs fine through Creator. But if I try to run it just by double-clicking on the .exe file in the file system, nothing seems to happen.

    This is a UI-less app (just reads some input files, and generates some output files).

    First, I got an error message, saying that it couldn't find a particular .dll, so I added the path to MinGW to the environment variables, and got past that.

    What needs to be done to make this work?

    Thanks...

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Scylla
      wrote on last edited by
      #2

      Set the environment variable (path) or put the neccesary dll/plugins beside the *.exe, see "here":http://developer.qt.nokia.com/doc/qt-4.8/deployment-windows.html. You can find the dependencies with "dependencywalker":http://www.dependencywalker.com/ .

      1 Reply Last reply
      0
      • mzimmersM Offline
        mzimmersM Offline
        mzimmers
        wrote on last edited by
        #3

        Thanks for the information. So, do I understand correctly, that in order to build a stand-alone application, I need to re-build Qt?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Scylla
          wrote on last edited by
          #4

          Yes, you have to build the Qt libs static. But then take care about the license issue!

          1 Reply Last reply
          0
          • mzimmersM Offline
            mzimmersM Offline
            mzimmers
            wrote on last edited by
            #5

            I need to pursue this a bit further. Let me provide a bit of information:

            For this application, I'm using Qt strictly as an IDE. I'm not using any of the Qt libraries or anything, except for the copy of MinGW (or whatever it's called). So, how am I going to run into licensing problems?

            And, since I'm modifying my pathname to find the .dll file(s), what else do I need to do to get this to run by double-clicking?

            Sorry if this question seems elementary, but it's really important I get past this, and do it right.

            Thanks.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Scylla
              wrote on last edited by
              #6

              If you start your application from QtCreator, the QtCreator set the path correct, to find the right lib (dll's). If you want to deploy your application, then you have two different choices. First, put the libs (dll's) and the application in the same folder. Second, build the Qt libs static and build your libs with them, so you can deploy your application alone just *.exe file. But when you use static Qt libs, you have to take care about the license . When you use the shared libs (dll's), you can use your own license.

              I hope this helps.

              1 Reply Last reply
              0
              • mzimmersM Offline
                mzimmersM Offline
                mzimmers
                wrote on last edited by
                #7

                OK, this may seem like a dumb question, but how do I determine whether my installation of Qt is built static or not?

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  tobias.hunger
                  wrote on last edited by
                  #8

                  You will need to put all the shared libraries you need next to the application itself or into some directory in the PATH of the machine. There should not be any need to link Qt statically (also that makes things easier of course;-).

                  If you are not using Qt at all in your program, then try adding

                  @
                  CONFIG -= qt
                  QT -= core gui
                  @

                  to your .pro-file and qmake should no longer link against the Qt libraries.

                  1 Reply Last reply
                  0
                  • mzimmersM Offline
                    mzimmersM Offline
                    mzimmers
                    wrote on last edited by
                    #9

                    There appear to be two shared libraries needed by my app:

                    • mingwm10.dll
                    • libgcc_s_dw2-1.dll

                    I first tried moving them to the same directory as the .exe file, and then modified my path variable to reflect their original location (restarting Creator to get the changes to take effect). Now, when I double click on the .exe file, I no longer get an error message, but...nothing seems to happen.

                    I realize this isn't really a deployment question anymore, but is there a way to find out what happened to these program launches?

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      Scylla
                      wrote on last edited by
                      #10

                      Did you try the dependency walker, what I mentioned above? Without you don't know your dependencies!

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        andre
                        wrote on last edited by
                        #11

                        If you say it is a console only application, without a GUI, what kind of output do you expect exactly? What happens if you run the application from a command prompt?

                        1 Reply Last reply
                        0
                        • mzimmersM Offline
                          mzimmersM Offline
                          mzimmers
                          wrote on last edited by
                          #12

                          [quote author="Andre" date="1329828263"]If you say it is a console only application, without a GUI, what kind of output do you expect exactly?[/quote]
                          Well, first of all, I expect the program to take about two minutes to run. That's how long it takes when launched from Creator. I also do write some minimal output to cout, which shows up in the "Application Output" area of Creator.
                          [quote]What happens if you run the application from a command prompt?[/quote]
                          After a few seconds, the prompt returns.

                          The input and output files to be used by the app appear untouched.

                          I wonder: I do use relative pathnames for my filenames in the app. Is it possible that when the app is launched from Creator, it "thinks" it's in a different directory? (I know I'm reaching here, but it seems like this might stem from an inability to open files.)

                          Is there a way in Windows to temporarily re-route the cout to a file? I have error messages in the app when a file open fails.

                          1 Reply Last reply
                          0
                          • mzimmersM Offline
                            mzimmersM Offline
                            mzimmers
                            wrote on last edited by
                            #13

                            Hi, Scylla -

                            I just tried dependencywalker. It does identify some files I wasn't aware of, and that might warrant a closer look.

                            But, doesn't Creator just use the system/user environment variables to construct its path? If not, what does Creator do differently that allows it to find these files?

                            EDIT:

                            It appears that all the needed files are in one of two directories:

                            • C:\windows\system32
                            • c:\qtsdk\mingw\bin

                            and both of those directories are in my PATH variable.

                            1 Reply Last reply
                            0
                            • S Offline
                              S Offline
                              Scylla
                              wrote on last edited by
                              #14

                              Take a look at the project-->Run Settings-->Run Environment, there you can see which variables are set from Qt Creator to run the app with correct path.

                              1 Reply Last reply
                              0
                              • mzimmersM Offline
                                mzimmersM Offline
                                mzimmers
                                wrote on last edited by
                                #15

                                You're talking about variables other than path, right? There are no environment variables unique to the run environment (all are inherited from the build environment).

                                In the build environment, all but two variables are inherited from the system environment. Those two that aren't are PATH and QTDIR. But everything listed in the build environment PATH variable is already in the system environment.

                                Again, can I re-route my cout somehow to make it visible to me? It would tell me if I'm not finding an application file.

                                1 Reply Last reply
                                0
                                • S Offline
                                  S Offline
                                  Scylla
                                  wrote on last edited by
                                  #16

                                  Now I don't know what's your problem is ;-). What do you want to know?
                                  I thougth you want to start you app without the development environment, isn't it?
                                  If this is wat you want, you have to put the Qt lib's in the same folder as the *.exe. Furthermore you need in this directory "mingwm10.dll" as well as the "libgcc_s_dw2-1.dll". Last two dll's are needed because you are using the mingw32 compiler. If your app needs a plugin like sqlite or jpeg, you have to put the needed plugins in this folder too. But the plugins need a special format i.e. sqlite plugin: sqldrivers/qsqlite4.dll.
                                  If you now have all dependecies resolved, you app should start. You should see with dependeny walker, that there is no "external" dependency like "c:\system32".

                                  1 Reply Last reply
                                  0
                                  • mzimmersM Offline
                                    mzimmersM Offline
                                    mzimmers
                                    wrote on last edited by
                                    #17

                                    [quote]I thougth you want to start you app without the development environment, isn’t it?[/quote]

                                    Yes, that's it exactly. I'd like the user to be able to double-click on the .exe file and have the app run, and/or start it from the command line.

                                    And, this particular app doesn't use any Qt libraries. It's just a plain .cpp program.

                                    I did try this with the two files you mentioned in the same directory as the app. The app no longer gives me an error, but it also doesn't run.

                                    So, I'm obviously missing something, which is probably quite elementary, because I'm pretty ignorant of Windows. This is why I was asking whether I could re-route my cout calls so I can see them. It's possible the program is starting up, running into an immediate problem (like a data file not found) and quitting, but...I have no visibility into this as it is.

                                    1 Reply Last reply
                                    0
                                    • S Offline
                                      S Offline
                                      Scylla
                                      wrote on last edited by
                                      #18

                                      Is this a commandline tool? Did you start your app from cmd.exe?

                                      1 Reply Last reply
                                      0
                                      • mzimmersM Offline
                                        mzimmersM Offline
                                        mzimmers
                                        wrote on last edited by
                                        #19

                                        I tried both. I double-clicked on the executable from a window, and I tried to run it via cmd.exe. Same results (nothing).

                                        1 Reply Last reply
                                        0
                                        • S Offline
                                          S Offline
                                          Scylla
                                          wrote on last edited by
                                          #20

                                          Can you provide the app, so I can test it?

                                          1 Reply Last reply
                                          0

                                          • Login

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