Deploying Qt with MinGW requires VC++ redistributable? - qt

I'm testing an application using Qt 4.7.3 compiled with MinGW on a clean XP virtual box. The application wasn't working and after much grief, I traced the error to needing to download the Visual C++ 2005 redistributable. I downloaded this and it worked. Something doesn't seem right here, shouldn't I not need any VC++ libraries since I'm using MinGW? Could it be a problem with my compilation? I should mention that I'm not using qmake to build.

The dependency on MSVCRT.DLL is due to MinGW itself. To quote mingw.org..
MinGW provides a complete Open Source programming tool set which is
suitable for the development of native MS-Windows applications, and
which do not depend on any 3rd-party C-Runtime DLLs. (It does depend
on a number of DLLs provided by Microsoft themselves, as components of
the operating system; most notable among these is MSVCRT.DLL, the
Microsoft C runtime library.
Also see: Should I redistribute msvcrt.dll with my application?

As noted in the Qt documentation, yes, that is required:
http://doc.qt.io/qt-5/windows-deployment.html

Related

Use Intel C++ Compiler (Composer) 2011 with Qt without Visual Studio on Windows

Why does the intel compiler on Windows keep nagging about visual studio? I don't have visual studio and I don't want it!!! is that the only option I have??? I'm a Qt programmer who've been using MinGW as a compiler, and never needed Visual Studio. On Linux, the intel compiler is totally independent and doesn't need any other compilers to work. Could anyone please explain what's the deal with this Intel Compiler and why it's not standalone?
Please tell me what I should do to get it to work with Qt without Visual Studio.
Edit: To be clear about the problem, when I try to use icl.exe to compile some file, it gives me this error:
icl: error #10114: Microsoft Visual C++ not found in path
Thanks for any efforts! :-)
On no platform is the Intel C/C++ compiler standalone. It requires tools of various kinds on all platforms.
The official documentation actually does list the entire gcc toolchain as a system requirement on Linux. Additional libraries are required as well.
It just so happens that on Windows, these tools are bundled with Visual Studio. The free version is sufficient.

Qt and Qt application prerequisites

I am new to Qt, and I am working in Windows 7.
When I try to run my application directly, I see an error about missing some DLLs. I tried to fix them, but I could not (I tried to build statically).
Is there any correct solution?
My question is:
If I want to run my Qt application on other computers, what do I need? For example, for a .NET application we need to install the .NET framework on the target computer, but what about for Qt?
I searched for its SDK and found a SDK that was about 1.6 GB! Does this mean every time I want to install my application I should install a 1.6 GB sized SDK? That's far too bad.
Thanks.
You have to distribute your application with needed libraries.
If your application is running on Windows you can follow this guide: Deploying an Application on Windows. You can find needed libraries as dll in bin directory inside SDK. A basic Qt gui application needs at least QTCORE4.DLL, QTGUI4.DLL and, if you are using Qt Creator, MINGWM10.DLL. You can leave these libraries in the same directory as you application.
You can't link statically against Qt unless you have built the libraries in that configuration (which you won't if you've just downloaded the pre-built SDK). Be aware that if you do want to link statically there are licensing implications for some components.
If you have built a release configuration then you will need at least the libraries Alessandro mentioned, QtCore4.dll and QtGui4.dll. Depending on the other parts of the library you're using you may also need QtXml4.dll QtWebkit4.dll, QtXmlPatterns4.dll and possibly Phonon.dll. Check that you are building a release configuration rather than a debug configuration, as this won't run as it needs the Visual Studio debug runtimes, which you can't redistribute. If you are in doubt which dlls you need then use DependencyWalker to find out (note that this doesn't show Phonon.dll as it is loaded later).
Generally you'll only need about 4-6 of the dlls, you won't need the whole SDK.
Please consider that many applications use Qt, you have some real chance the DLLs are already installed. Anyway, beware of MSVC dependencies: we had some real nightmare deploying applications on some server, partly related to a policy switch from VS2005 to VS2008. Alessandro already given a good resource: see also this previous post.
If you're working with Qt5, besides the .dlls mentioned by the first answer, you must also add the platforms/ folder from the bin directory inside the SDK.

Qt cross-platform development?

I just have a little question about running Qt created apps on different operating systems.
As a normal user do i have to install Qt framework to run Qt apps ?
I mean i've created Qt app using Windows , then i made a build for Linux .
Do i need to install the Qt framework on the Linux pc inorder to run that app ?
Or there is a way to package all the needed libraries into the app installer .
Best Regards
You can deliver the dynamic libs you need with your application, as it's described here:
http://doc.qt.io/qt-5/deployment.html
Since Qt is not a system library, it has to be redistributed along
with your application; the minimum is to redistribute the run-time of
the libraries used by the application. Using static linking, however,
the Qt run-time is compiled into the executable.
Depends what you mean by 'framework', you will need the runtime libraries, unless you paid Nokia for a license to allow static linking.
For Linux, I think you would generally ensure that the Qt packages have been installed during installation (i.e. make them a requirement of the package you provide). Under Mac OS you would need to package the .so (shared objects) with your application. Under Windows you do the same (provide the .dlls) and install them with the application (not in the system folders).
The issue with static linking that #cbamber85 is alluding to, is the conformance with the LGPL licence where it's legal to link to the libraries at runtime but not at compile time (i.e. use the .so/.dll but not the .a files).

Porting QT application from Linux to Windows?

Greetings all,
We are developing a QT application (QT 4.6 LGPL version) in Linux platform.All the libraries we use are cross-platform.
Now we want to port it into Windows and continue develop in Windows.
My questions are:
Which compiler should we use ,Can we use MinGW or Visual C++ compiler?
2.If its Visual C++ compiler, which Visual Studio version should be used ,can we use 'Visual C++ Studio 2010 express' ?
thanks in advance.
The easiest, by far, is to install QtCreator. it includes MinGW and simply opens the same project files as on linux. compile, and go!
A huge advantage of MinGW over VC++ is that it doesn't make you chase circles around getting the right vcredist library for the exact version of the compiler, nor it cares too much about debug/release builds. To deploy, just be sure to copy the same one or two DLLs you have on the development machine. A few more for Qt, but these are well-documented on Qt docs. No hidden surprises.

Qt/QuickFIX - doesn't find some header files

I am using both Qt Framework and QuickFIX engine to create a financial application with GUI.
My problem is that when I compile a program that implements QickFIX engine and Qt Framework, it gives me a compilation error: it doesn't find some header files in MinGW (socket.h, inet/in.h, etc)
I am on Windows 7 and I know that to use sockets you must use winsock.h and so on, but the problem is I have Visual C++ express edition and it's not supported by Qt, so I used Qt Creator and since I have an open source of Qt, QuickFIX engine uses the header files of Linux (socket.h, etc) rather than windows. So it gave me an error.
Please can you suggest me a solution?
I use Visual Studio Express 2010 with Qt. You will need to build Qt with it. When you configure make sure to specify Visual Studio 2010 as the make spec.Last time I built it got hung up on a couple of projects. To get around this you need to clear out some temporary files that Nokia packaged in the installer for some reason. Just google the error for details.
Once you have Qt built you ought to be able to qmake -tp vc your project and then load up the generated Visual Studio project file.

Resources