Running Qt app on different computers - c++

I've just finished my first Qt program. I compiled it with MinGW 32bit compiler.
On my computer I have installed all necessary dll files when I was installing Qt.
After Profile/Debug/Release I can successfully run the app on my computer.
but..
On second computer (also Windows 10) I'm getting errors about missing dll files.
Qtguid.dll, qtwidgets and many more. I tried to put some missing dll files to the program directory. New errors occurred, like 0xc00007b.
What can I do to solve these problems with dll files? What can I do to make this app be able to run on different PCs?

If you are compiling your app under Windows, 32bit version it's completly compatible with x64 bits version. There is no problem running the app in Windows 7 or 10 if you are using only Qt dlls.
I recommend you to check Qt Deployment Documentation and use windeployqt to get all required dll files. Basically:
Compile your app in Release mode.
Create a new folder and copy your generated exe file to this folder.
Acces to the Qt Mingw32 (or MSVC) command promp and go to the folder and run:
cd C:/myFolder
windeployqt .
Windeployqt will copy all required files in this folder. When the process finished, just run the app. Compress the folder in rar or zip and test it in other computers.
If the problem still happens, use DependencyWalker to check the required dlls. Copy the required files in the folder.
When all works fine, you can use InnoSetup to create an installer.

Related

Procedure Entry Point could not be located: Qt MinGw CPP Desktop App crashes when run

In my Qt Desktop app, I have included the <filesystem> in one of my .cpp files. When I compiled it with the MinGw 8.2 version there were errors everywhere. I tried downloading MinGw through MSyS2 and now the application compiles successfully. However, when I try to run it, it crashes, and shows me this error:
Your application is loaded with a dynamic library which is not same version with the dynamic library that you build your application against。
You can find out the dll which your application was built against and put it into the directory where your application is

Unable to build for Windows on Linux, with MinGW

Because I am not a Java enthusiast, I decided to use C++ and Qt for one of my projects. However, I came across the big cross-compiling Qt problem, and I am unable to produce an .exe file for Windows users.
My setup
Linux Ubuntu 12.04, with Wine and Qt. qmake -v gives the following output :
QMake version 2.01a
Using Qt version 4.8.1 in /usr/lib/x86_64-linux-gnu
I also have a MinGW32 compiler, which can be found at /usr/bin/i586-mingw32msvc-g++. My Wine drive_c folder contains the following Qt directories :
$HOME/.wine/drive_c/Qt/Qt5.2.0/5.2.0/Src
$HOME/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32
The mingw48_32 directory contains the necessary include/ and lib/ directories, which are used in my mkspec file, /usr/share/qt4/mkspecs/win32-x-g++/qmake.conf :
QMAKE_INCDIR_QT = /home/me/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32/include
QMAKE_LIBDIR_QT = /home/me/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32/lib
The problem
According to most guides I've found about Qt cross-compiling, my setup should be enough to run a simple :
qmake -spec win32-x-g++
make
wine /path/to/my/application.exe
But... nothing's linked. QApplication and every other symbol I use in my program are "not found". No QApplication, no QPushButton, no connect(), no SIGNAL(), no SLOT()...
My objective here is to successfully configure QtCreator to use this setup (in an independent build configuration), so that it can build a Linux executable (through the first and working configuration), and a Win32 .exe (through the MinGW setup above). However, I cannot modify a single build step in QtCreator :
Cannot add a "MinGW" toolchain : it is not available in the "Add" dropdown list.
Cannot change the -spec parameter value in the project build configurations panel. The field is non-editable.
Despite guides and solutions I found all over the Internet, my only solution so far is to send my source code to a virtual Windows machine, and have it create a new project with it. On this VM, I could probably compile for Windows... But of course, this doesn't actually sound like a real "solution" to me...
Is there any way Qt(Creator) has finally made cross-compiling easier now ? I'm getting a bit tired of "symbol not found" errors...
First,
sudo apt-get install mingw-w64
Then, check if Qt Creator finds the toolchain.
Next, until Ubuntu starts providing a mingw-w64-qt package, download the Qt source and build it. This is bound to get messy, and maybe even the simplest thing to do is to install WINE and use a Windows Qt version.

Missing libgcc_s_dw2-1.dll Error when launching MinGW Compiled exe

I receive an error message when launching a MinGW compiled executable. I'm using a Windows 7 machine.
I have the MinGW bin directory in my Windows Path environment variable (checked and re-checked) and said dll does exist in that folder.
I understand I could move the dll to the exe directory but the application doesn't need to be distributed to anywhere that doesn't have a MinGW installation with the environment variable set up correctly (standard environment on our work machines). Many colleagues are using the same executable without an issue. The only difference I know of is that most (possibly all) colleagues are working on Windows XP, with me on Windows 7.
Additionally I do not have access to the build server to change the compiler flags to static link the library.
So despite the workarounds I mention, I want to get to the bottom of why it doesn't work with the current setup.
Any help would be appreciated!
Cheers.
What version of mingw are you using? 4.4.0?
Download the package gcc-core-4.4.0-mingw32-dll.tar.gz from here.
Copy required dll from the bin folder into your mingw bin folder.

How to compile Qt statically under Windows?

After successfully installing the Qt SDK 4.7.4 (MingW) and building an application I can find no way to deploy my program. Qt is really nice, but to deploy under Windows means to leave he surfaced road.
First the executable requires QtCore4.dll plus some other DLLs, but the Creator does not copy them into the deploy folder. Do I really have to try DEPENDS.EXE, to find out which DLLs are required, and then cull them manually from somewhere under C:/QtSDK?
Be that as it may, preferably I want to link statically. There are few recipes on the net how this can be done (e.g. here and here). So I launched a Qt 4.7.4 Desktop (MingW) command prompt. The Qt Reference Documentation tells to run CONFIGURE.EXE, but there's no CONFIGURE.EXE and no CONFIGURE.CMD, not under C:/QtSDK and not under C:/.
What am I missing?

Using QtMobility in QtCreator: Setup?

I am trying to set up a development environment to play around with developing Qt apps for Symbian devices. I have succesfully set up the environment and am able to create simple apps such as HelloWorld and get them to run on my device. I would now like to try using the QtMobility package, but I am struggling to get it to work in QtCreator.
I got some sample code for using the camera (initially I only had QtMobility 1.0.2, but I have now downloaded the 1.1.0 technology preview version). I followed the instructions in the help file to install it, here is what I did:
Extracted the zip file to C:\QtMobility
Opened a Qt Command prompt and ran configure (in the QtMobility directory)
Ran mingw32-make
Ran mingw32-make install
Finally I updated my PATH variable to include C:\QtMobility\lib
I went back to QtCreator (restarted it) and looked at the cpp file that first calls the macro QTM_USE_NAMESPACE but it is still underlined in red, because it can't find the qmobilityglobal.h file.
Does anyone know if I have missed anything out during the installation that will tell the QtCreator where to find the QtMobility header files?
mingw32-make suggests you're building for win32-mingw target environment. To work with Symbian SDKs, you should be building for e.g. symbian-abld instead. The configure.bat script will auto-detect the target you are building for. Just make sure that QT_PATH environment variable points to a location where you have a Symbian build of the Qt toolchain.
(Also note that make install is unnecessary with symbian-abld - the build step already puts everything in place in Symbian SDK directories.)