[SOLVED] NEW and CONFUSED



  • I need all the help I can get. I'm an absolute beginner with Qt and C++
    I've downloaded and installed: Qt 5.0.2 with mingw 4.7.4 to desktop PC running Windows 7 x64
    I can run the examples directly from Qt Creator and they are OK! However, when I go through the first tutorial ("Transitions") I get errors and the tutorial does NOT run.

    Also. If I copy the "Examples" folder to another directory, the examples will not build/run from this new location.

    See below.

    Thanks

    20:48:44: Running steps for project Transitions...
    20:48:44: Configuration unchanged, skipping qmake step.
    20:48:44: Starting: "C:\Qt\Qt5.0.2\Tools\MinGW\bin\mingw32-make.exe"
    C:/Qt/Qt5.0.2/Tools/MinGW/bin/mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory 'C:/Users/Steve/Desktop/Qt_Tutorials/build-Transitions-Desktop_Qt_5_0_2_MinGW_32bit-Debug'
    20:48:47: The process "C:\Qt\Qt5.0.2\Tools\MinGW\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project Transitions (kit: Desktop Qt 5.0.2 MinGW 32bit)
    When executing step 'Make'
    20:48:47: Elapsed time: 00:03.

    ________________________________________________________________________________________
    

    A window also pops up with message:

    "sh.exe has stopped working" . . . . . Close the Program





  • Thanks for your quick response.
    I will re-install and try the tutorials again tonight, and inform you of my
    results.



  • I re-installed Qt 5.1 with MingW48. I completed the beginners tutorial.
    All worked fine. >>> However >>>>
    Where's the "EXE"? I've built and run the tutorial but it doesn't create an independent application. Is there another step? or is the exe hidden in a folder somewhere? I've also copied the exe from the included example demo's, and they don't run outside the original example folder.

    I appreciate your help.

    Thanks.


  • Moderators

    [quote author="nHx4U" date="1373037925"]
    Where's the "EXE"? I've built and run the tutorial but it doesn't create an independent application. Is there another step? or is the exe hidden in a folder somewhere?[/quote]With your project open, click the "Projects" button on the left of Qt Creator. That will show you the "build directory" where the .exe is produced.

    This technique is called "shadow building" -- the .exe is built in a folder separate to your source code, to keep your code directory clean.

    [quote]I've also copied the exe from the included example demo's, and they don't run outside the original example folder.[/quote]You need more than the .exe. You also need the DLLs that the .exe depends on. See "Creating the Application Package" at http://qt-project.org/doc/qt-5.1/qtdoc/deployment-windows.html#creating-the-application-package (but the only plugin you need is platforms\qwindows.dll -- ignore the instructions for other plugins)



  • Sorry. Still can't create a "Stand-Alone" package. I followed your instructions and created a "release" version (exe) in a separate folder. I've added a subfolder "platforms\windows.dll". I used "Dependency Walker" and copied the suggested .dll's into the folder, and it still won't run!. (Lots of DLL's. Some show up in 2 different locations and file sizes: one in MingW and also in Qt. I selected the mingw files. These were typically larger than the similar named Qt dlls.)

    I created a simple app from:

    http://qt-project.org/wiki/Basic_Qt_Programming_Tutorial

    and also tried to follow the instructions in:

    http://qt-project.org/doc/qt-5.0/qtdoc/deployment-windows.html#application-dependencies


  • Moderators

    Please list all the contents of the folder where you tried to put your standalone package (.exe, .dlls, and subdirectories) -- it's hard to tell what you've put in there from broad descriptions alone.

    [quote author="nHx4U" date="1373405075"]Some show up in 2 different locations and file sizes: one in MingW and also in Qt.[/quote]Please also list the absolute paths of these 2 folders that contain the DLLs



  • Here's the PATH and Contents:

    C:\USERS\STEVE\DESKTOP\Qt_TUTORIALS\Qt_TUTORIAL-01\

    • Qt-Ttutorial-01.exe

    • moc_widget.cpp

    • api-ms-win-core-console-l1-1-0.dll

    • D3DCompiler_43.dll

    • icudt51.dll

    • icuin51.dll

    • icuuc51.dll

    • IEShims.dll

    • libEGL.dll

    • libgcc_s_dw2-1.dll

    • libgcc_s_sjlj-1.dll

    • libGLESv2.dll

    • libstdc++-6.dll

    • libwinpthread-1.dll

    • mingwm10.dll

    • Qt5Core.dll

    • Qt5Gui.dll

    • Qt5Multimedia.dll

    • Qt5MultimediaWidgets.dll

    • Qt5Network.dll

    • Qt5OpenGL.dll

    • Qt5Widgets.dll

    • QtCore4.dll

    • QtGui4.dll

    • main.o

    • moc_widget.o

    • widget.o

    • \PLATFORMS\
      Qwindows.dll

    Thank you.



  • Sorry. My last reply was not clear. Resent.

    C:\USERS\STEVE\DESKTOP\Qt_TUTORIALS\Qt_TUTORIAL-01\

    1. Qt-Ttutorial-01.exe
    2. moc_widget.cpp
    3. api-ms-win-core-console-l1-1-0.dll
    4. D3DCompiler_43.dll – icudt51.dll
    5. icuin51.dll
    6. icuuc51.dll
    7. IEShims.dll
    8. libEGL.dll
    9. libgcc_s_dw2-1.dll
    10. libgcc_s_sjlj-1.dll
    11. libGLESv2.dll
    12. libstdc++-6.dll
    13. libwinpthread-1.dll
    14. mingwm10.dll
    15. Qt5Core.dll – Qt5Gui.dll
    16. Qt5Multimedia.dll
    17. Qt5MultimediaWidgets.dll
    18. Qt5Network.dll
    19. Qt5OpenGL.dll
    20. Qt5Widgets.dll
    21. QtCore4.dll
    22. QtGui4.dll
    23. main.o
    24. moc_widget.o
    25. widget.o
    26. \PLUGINS\
    27.                          Qwindows.dll
      

  • Moderators

    Sorry, I missed your last post.

    "PLUGINS\Qwindows.dll" should be "platforms\qwindows.dll"

    You have both Qt 4 (QtCore4.dll, QtGui4.dll) as well as Qt 5 (Qt5Core.dll, Qt5Gui.dll) DLLs -- those don't go together. Uninstall Qt 4 from your system completely and remove the Qt 4 DLLs. Then, delete these and re-compile your project

    • Qt-Ttutorial-01.exe
    • moc_widget.cpp
    • *.o

    Get rid of api-ms-win-core-console-l1-1-0.dll and IEShims.dll -- those are system DLLS which you shouldn't need to deploy (Dependency Walker gave you false warnings here)

    [quote]Some show up in 2 different locations and file sizes: one in MingW and also in Qt. I selected the mingw files. [/quote] Use the ones in the "Qt" folder. Also, please list the DLLs that you found in two places.

    Some questions:

    • Did you uninstall Qt 5.0.2 before trying to compile with Qt 5.1? If not, uninstall Qt 5.0.2
    • Do you have multiple installations of MinGW in your computer? If you do, uninstall all others except for the one that came with Qt.


  • Thanks for your reply.
    I've performed your last suggestions, and now get these errors:

    When clicking Qt-Ttutorial-01.exe from RELEASE folder:

    1. The procedure entry point
      _Z8qWinMainP11HINSTANCE_S0_PciRiR7QVectorIS1_E could not
      be located in the dynamic link library Qt5Core.dll.

    When running release build from Qt Creator (Qt-Tutorial-01.pro):

    1. Starting C:\Users\Steve\Desktop\Qt_Tutorials\Qt-Tutorial-01\build-Qt-Ttutorial-01-Desktop_Qt_5_1_0_MinGW_32bit-Release\release\Qt-Ttutorial-01.exe...
      The program has unexpectedly finished.
      C:\Users\Steve\Desktop\Qt_Tutorials\Qt-Tutorial-01\build-Qt-Ttutorial-01-Desktop_Qt_5_1_0_MinGW_32bit-Release\release\Qt-Ttutorial-01.exe exited with code -1073741511

    3. Running from the DEBUG build (in Qt Creator) works properly.



  • For your 1st and 2nd error I would say it's a .dll problem, do you still have Qt4 or Qt5.0.2 dll in your release folder ?
    Maybe you're compiling with Qt5.1 but the ones that are used are Qt5.0.2.



  • Thought I deleted everything other than Qt 5.1

    I will use a "deep" uninstaller and clear everything Qt and re-install Qt 5.1

    I will get back to you on results in a few days.

    Thanks for your help.


  • Moderators

    [quote author="nHx4U" date="1374110617"]

    1. The procedure entry point
      _Z8qWinMainP11HINSTANCE_S0_PciRiR7QVectorIS1_E could not
      be located in the dynamic link library Qt5Core.dll.[/quote]That means the program is using the wrong version of the DLL.

    Question: Are you absolutely sure that you only have 1 version of Qt in your computer, and you have uninstalled all other versions?

    Do this first:

    Delete the folder C:\Users\Steve\Desktop\Qt_Tutorials\Qt-Tutorial-01\build-Qt-Ttutorial-01-Desktop_Qt_5_1_0_MinGW_32bit-Release

    Build your project again in Qt Creator

    Copy the DLLs that you need from C:\Qt\Qt5.1.0\mingw48_32\bin -- (if this is NOT where your DLLs are found, tell us the full directory)

    Secondly, open a Windows Command Prompt (click Start -> Run, type in "cmd", and press Enter). Run this command...
    @
    path > C:\Users\Steve\Desktop\path.txt
    @
    ...then open the text file on your desktop and paste the result here.

    [quote author="nHx4U" date="1374110617"]I’ve performed your last suggestions[/quote]Please be more descriptive in the future, and give step-by-step details of what you did. If you just say "I’ve performed your last suggestions", I can't tell if you performed it correctly or not.



  • TO: JKSH (and others who have responded). Thank you very much.
    I have performed tasks 1,2,3 above AND it actually works! :-)

    Below is list of files and locations. Actual DLLs used were copied from Qt..\mingw subfolder.

    FOLDER
    C:\USERS\STEVE\DESKTOP\Qt_TUTORIALS\Qt_TUTORIAL-01\ File Source File Size - KB Alternate Location Alternate Size - KB

    1 D3DCompiler_43.dll C:\Qt-51\Qt5.1.0\Tools\QtCreator\bin\ 2057 C:\windows\SysWOW64\ 2057
    2 icudt51.dll C:\Qt-51\Qt5.1.0\Tools\QtCreator\bin\ 21794 C:\Qt-51\Qt5.1.0\5.1\mingw48_32\bin\ 21854
    3 icuin51.dll C:\Qt-51\Qt5.1.0\Tools\QtCreator\bin\ 1726 C:\Qt-51\Qt5.1.0\5.1\mingw48_32\bin\ 3291
    4 icuuc51.dll C:\Qt-51\Qt5.1.0\Tools\QtCreator\bin\ 1266 C:\Qt-51\Qt5.1.0\5.1\mingw48_32\bin\ 1933
    5 libEGL.dll C:\Qt-51\Qt5.1.0\Tools\QtCreator\bin\ 47 n/a
    6 libgcc_s_dw2-1.dll C:\Qt-51\Qt5.1.0\5.1.0\mingw48_32\bin\ 533 C:\Qt-51\Qt5.1.0\Tools\mingw48_32\bin\ 533
    7 libgcc_s_sjlj-1.dll C:\Program Files\PostgreSQL\9.2\bin 76 C:\Program Files\PostgreSQL\9.2\bin\postgisgui 40
    8 libGLESv2.dll C:\Qt-51\Qt5.1.0\Tools\QtCreator\bin\ 712 n/a
    9 libstdc++-6.dll C:\Qt-51\Qt5.1.0\5.1.0\mingw48_32\bin\ 967 C:\Qt-51\Qt5.1.0\Tools\mingw48_32\bin\ 967
    10 libwinpthread-1.dll C:\Qt-51\Qt5.1.0\5.1.0\mingw48_32\bin\ 73 C:\Qt-51\Qt5.1.0\Tools\mingw48_32\bin\ 73
    11 mingwm10.dll C:\Program Files(x86)\PostgreSQL\UpdateMonitor\bin 16 n/a
    12 Qt5Core.dll C:\Qt-51\Qt5.1.0\Tools\QtCreator\bin\ 3764 C:\Qt-51\Qt5.1.0\5.1\mingw48_32\bin\ 4287
    13 Qt5Gui.dll C:\Qt-51\Qt5.1.0\Tools\QtCreator\bin\ 2856 C:\Qt-51\Qt5.1.0\5.1\mingw48_32\bin\ 4346
    14 Qt5Multimedia.dll C:\Qt-51\Qt5.1.0\Tools\QtCreator\bin\ 528 C:\Qt-51\Qt5.1.0\5.1\mingw48_32\bin\ 797
    15 Qt5MultimediaWidgets.dll C:\Qt-51\Qt5.1.0\Tools\QtCreator\bin\ 74 C:\Qt-51\Qt5.1.0\5.1\mingw48_32\bin\ 124
    16 Qt5Network.dll C:\Qt-51\Qt5.1.0\Tools\QtCreator\bin\ 806 C:\Qt-51\Qt5.1.0\5.1\mingw48_32\bin\ 1361
    17 Qt5OpenGL.dll C:\Qt-51\Qt5.1.0\Tools\QtCreator\bin\ 238 C:\Qt-51\Qt5.1.0\5.1\mingw48_32\bin\ 392
    18 Qt5Widgets.dll C:\Qt-51\Qt5.1.0\Tools\QtCreator\bin\ 4170 C:\Qt-51\Qt5.1.0\5.1\mingw48_32\bin\ 6003
    19 Qt-Ttutorial-01.exe Created by Qt Creator 44 n/a
    \PLATFORMS\ n/a
    1 Qwindows.dll C:\Qt-51\Qt5.1.0\Tools\QtCreator\bin\plugins\platforms 814 n/a

    (Above would be clearer if one could include attachments or at least have a horizontal scroll in this window)

    HERE IS THE PATH FILE:

    PATH=C:\Python27;C:\Perl64\site\bin;C:\Perl64\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn;c:\sdc\orant\bin;c:\sdc\oraclexe\app\oracle\product\10.2.0\server\bin;c:\sdc\unix;C:\Program Files (x86)\Microsoft SQL Server\80\Tools\Binn;C:\Program Files (x86)\AgentOffice;C:\Program Files (x86)\Calibre2;H:\QuickTime\QTSystem\

    How does one know which files to include in the release folder - Other than "Dependency Walker"? When a particular DLL shows up in both Qt and mingw do you always choose the mingw? The mingw files are typically larger than the ones in the Qt folder.

    I will now go on to attempt something more complex.

    Thanks for all your help. Really appreciate it.


  • Moderators

    Glad to hear! :) I hope you have fun exploring what Qt has to offer. If you have any more questions, please feel free to ask in these forums, and I'm sure someone will try to help you.

    From this exercise, the take-home messages are:

    • Be aware of the libraries that you're using.
      ** If there are multiple versions on your computer, always ensure that you are linking to the correct version, and that you copy the correct DLLs
    • When you upgrade or change something (such as your libraries, or even your source code), you may need to delete your previously-compiled files because they could be linked to old libraries
      ** Some problems can be solved by deleting those files and re-compiling from scratch, like what you just did

    [quote]
    File Source File Size – KB Alternate Location Alternate Size – KB

    Qt5Core.dll C:\Qt-51\Qt5.1.0\Tools\QtCreator\bin\ 3764 C:\Qt-51\Qt5.1.0\5.1\mingw48_32\bin\ 4287[/quote]Actually...

    This folder contains your Qt library (YOU SHOULD COPY THESE DLLS FOR YOUR STANDALONE APPLICATION):

    • C:\Qt-51\Qt5.1.0\5.1\mingw48_32\bin\

    This folder contains the Qt Creator IDE (code editor), not your Qt library

    • C:\Qt-51\Qt5.1.0\Tools\QtCreator\bin\

    This folder contains your MinGW compiler

    • C:\Qt-51\Qt5.1.0\Tools\mingw48_32\bin

    Qt Creator is a standalone application. Its DLLs could be older than your library, so you don't want to copy those!



  • I also have the same problem.
    My Application is based on Qt5.1
    My system used:

    • Qt5.1
    • Mingw32
      I can't find the mingw10.dll and libgcc_s_sjlj-1.dll in C:\Qt-51\Qt5.1.0\Tools\mingw48_32\bin.
      Please help to deploy application compiled in mingw to other window PC.

  • Moderators

    [quote author="vtong" date="1375093795"]I also have the same problem.
    My Application is based on Qt5.1
    My system used:

    • Qt5.1
    • Mingw32
      I can't find the mingw10.dll and libgcc_s_sjlj-1.dll in C:\Qt-51\Qt5.1.0\Tools\mingw48_32\bin.
      Please help to deploy application compiled in mingw to other window PC.[/quote]Which Qt package did you download? (Please provide the full link)

    Where did you install MinGW?



  • [quote author="JKSH" date="1375097634"][quote author="vtong" date="1375093795"]I also have the same problem.
    My Application is based on Qt5.1
    My system used:

    • Qt5.1
    • Mingw32
      I can't find the mingw10.dll and libgcc_s_sjlj-1.dll in C:\Qt-51\Qt5.1.0\Tools\mingw48_32\bin.
      Please help to deploy application compiled in mingw to other window PC.[/quote]Which Qt package did you download? (Please provide the full link)

    Where did you install MinGW?[/quote]

    Thanks for your response.
    I downloaded the Qt5.1 from: http://download.qt-project.org/official_releases/qt/5.1/5.1.0/qt-windows-opensource-5.1.0-mingw48_opengl-x86-offline.exe
    After I installed, I have a folder: C:\Qt\Qt5.1.0
    I used all library from: C:\Qt\Qt5.1.0\5.1.0\mingw48_32\bin
    I searched and found a lot solution but no ones work for me.
    Note: I use Qwt-6.1.0 in my application, I build and install it by Command Prompt from Qt the I installed


  • Moderators

    The MinGW in that package uses Dwarf-2 instead of SJLJ, so replace libgcc_s_sjlj-1.dll with libgcc_s_dw2-1.dll.

    Also, MinGW has changed: you don't need mingwm10.dll anymore, but you now need libwinpthread-1.dll



  • @JKSH: Thanks for your advice.
    I did copy all the files you mention to application folder, I all so put platform folder as well.
    But somehow the application still show Visual C++ Runtime error when I run it in other PC.
    Very confused now.
    Please advice.
    Thanks


  • Moderators

    If it's showing a Visual C++ error, that means your binary was compiled with Visual Studio, not MinGW... Check that:

    You are using the correct Qt package

    You are using the correct compiler



  • I used MingW, to make sure nothing wrong, I removed the msvc-2010 from the Qt installed directory, but the error still happened.
    It pop up a window with message: "This application has requested the Rumtime to terminate it in an unsual qat. Please contact...."


  • Moderators

    "This application has requested the Runtime to terminate it in an unusual way" is definitely a Visual Studio message. You need to clean your environment.

    Uninstall all versions of Qt except for the MinGW one. Remove Visual Studio from your PATH. Delete your *.o and *.exe files and recompile.

    If you still can't solve the problem, uninstall Visual Studio and try again.



  • Hi JKSH,
    I did all things you mention, but when I run my app on another PC, it pop up another message: "The application failed to start because it could not find or load platform plugin "windows". Reinstalling the application may fix this problem"
    When I click OK, it come with Visual C++ Runtime library error.
    Don't know why this happen, even I copy the platforms/qwindows.dll from mingw_32/bin.
    Any idea to fix this?


  • Moderators

    Can you run the application from your development PC, in Qt Creator?

    Can you run the application from your development PC, outside of Qt Creator (double-click the .exe)?

    Did you install Qt on your other PC? You must not have Qt in your PATH. If you do, your application might try to use the wrong version of DLLs.

    qwindows.dll must be in a subfolder:
    myapp\myapp.exe
    myapp\Qt5Core.dll
    myapp\platforms\qwindows.dll



  • [quote author="JKSH" date="1375235308"]# Can you run the application from your development PC, in Qt Creator?

    Can you run the application from your development PC, outside of Qt Creator (double-click the .exe)?

    Did you install Qt on your other PC? You must not have Qt in your PATH. If you do, your application might try to use the wrong version of DLLs.

    qwindows.dll must be in a subfolder:
    myapp\myapp.exe
    myapp\Qt5Core.dll
    myapp\platforms\qwindows.dll[/quote]

    I put app and dlls as the same as your suggestion.
    To answer your questions:
    1/ I can run the app from Qt Creator (Press Run button).
    2/ I can't run the app outside Qt Creator, double-click exe from Release folder or from other folder, I must copy all requred dlls to the app folder to make it run.
    3/ The other PC is fresh, no Qt Installed.



  • [quote author="vtong" date="1375244963"]
    [quote author="JKSH" date="1375235308"]# Can you run the application from your development PC, in Qt Creator?

    Can you run the application from your development PC, outside of Qt Creator (double-click the .exe)?

    Did you install Qt on your other PC? You must not have Qt in your PATH. If you do, your application might try to use the wrong version of DLLs.

    qwindows.dll must be in a subfolder:
    myapp\myapp.exe
    myapp\Qt5Core.dll
    myapp\platforms\qwindows.dll[/quote]

    I put app and dlls as the same as your suggestion.
    To answer your questions:
    1/ I can run the app from Qt Creator (Press Run button).
    2/ I can't run the app outside Qt Creator, double-click exe from Release folder or from other folder, I must copy all requred dlls to the app folder to make it run.
    3/ The other PC is fresh, no Qt Installed.[/quote]

    (UPDATE):
    I just do REcompile with a fresh project from my github:
    I clean all file from Release folder, remove some path in PATH, remove Visual Studio.
    Recompile and Run from Qt Creator, it show the Visual C++ Runtime Library.
    Please advise, thanks


  • Moderators

    Hmm... Please open your project in Qt Creator and provide screenshots of the following:

    • (Top menu bar) -> Tools -> Options -> Build & Run -> Compilers
    • (Top menu bar) ->Tools -> Options -> Build & Run -> Kits
    • (Left menu bar) -> Projects

    quote author="vtong" date="1375245456":
    I just do REcompile with a fresh project from my github:[/quote]

    Is this the same project that you are trying to run on your other PC? Can you provide a GitHub link?



  • I did an experiment by uninstall all Qt from my PC then run the app
    myapp/app.exe
    myapp/*dll (all dlls required to run the app)
    myapp/platforms/qwindows.dll

    The error message appeared.

    Then I Re-Install Qt5.1 MingW32
    The App run OK, withou error message.
    Do you have any idea?
    I did check the Path in Environment Variables, don't have any value related to Qt installed folder.



  • Hi JKSH,
    I used Process Monitor program then I found something interesting:

    • The Application has error always used files from Qt Install Directory, e.g: platforms.
    • I create a similart app, It uses files from directory that I copy.
      Here is the situaton, all file in a folder in D drive, Qt Install in C:\Qt:
      D:\MyProject
      MyApp.exe
      *.dll (All required dll: Qt5Core.dll, Qt5Gui.dll,...
      platforms/qwindows.dll
      MySimilarApp.exe
      If I rename Qt5.1 to Qt5.1___ (for example)
      MyApp.exe ran with error.
      But when I return the name to origial one: Qt5.1, MyApp.exe ran withou error.
      MySimilarApp.exe ran without error, don't care the Qt5.1 folder name.

    I don't know why this happened.


  • Moderators

    Very strange... I've never seen that before.

    You said MySimilarApp.exe is ok. What happens if you re-compile Qwt and MyApp.exe after you uninstalled and reinstalled Qt 5.1?



  • [SOLVED]
    I solved the problem.
    The error caused by some QImage Variables I declared at the top of mainwindow.cpp (after #include, of course).
    By moving these variables to mainwindow.hpp, it works perfectly.
    Special thanks to:
    JKSH for your willingness to support me.
    Process Monitor enabled me to captured and isolated the root cause.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.