Does Qt require the user to install a certain framework on a desktop?



  • Hi,

    I'm trying to find an alternative to the current C# (.NET) I'm using nowadays, as casual developer.
    A con of C# was that it just works on Windows platforms, but I want to cover Linux (Ubuntu) as well.
    Another con was that the user has to install the .NET framework.

    Can Qt/C++ applications run on both Windows and Linux (and preferably Mac, but that doesn't really matter) environments without installing frameworks like .NET?
    For Windows I'd like to provide a standalone .exe file, is this possible?

    Thanks,

    ~ Tgys



  • Hello, ~Tgys.

    Welcome to Qt Developer Network!

    Qt support dynamic and static -linked application build system. It allows to build application dependable on .dll/.so/.dylib or build it static (without dependencies).

    Qt dynamic builds only depends on a few .dll/.so/.dylib - QtCore and optionaly others - QtGui, QtNetwork...

    For example, I have three Qtes on my computer:

    • Qt 4.8.2 dynamic - /opt/qt/482
    • Qt 2.8.2 static (for windows) - /opt/qt/482-static
    • Qt 5 (from repository with auto-pull and build script) - /opt/qt/5

    And when I want to build static application, I only have to change build tool.

    Instructions to build static Qt (on windows) - on devnet "wiki":http://qt-project.org/wiki/How_to_build_a_static_Qt_version_for_Windows_with_gcc



  • I see, thanks for the explanation.
    I'll dig into Qt further the coming few days, seems to suit my needs.



  • Hi Tgys,

    There should be said something more, the licensing

    • using dynmic linkage, you can use the GPL, LGPL or commercial license
    • if you want to use static linking, GPL or commercial is possible (afaik)


  • Thanks for the information.
    The license isn't any problem for me, but of course good to know in time :).



  • I think it should be noted that you do not need to "install" Qt in order to deploy the application. As Qt is a C++ framework, Qt applications are usually written in C++ too - although Qt bindings for other languages do exist as well. C++ applications are compiled to "native" (machine) code and thus will run out-of-the-box.

    With C++, there is no need to to install a "runtime environment", such as the .NET Framework for .NET applications or the JRE for Java applications. Depending on what C++ compiler (and compiler settings) you use, you may need to ship a C++ Runtime DLL along with your application tough. Still, this is just a single DLL file you need to ship along with your EXE file. It's nothing that needs to be "installed" separately by the user!

    As for Qt, applications built with Qt will of course depend on the Qt libraries. You can built your application with the static Qt libraries, so you get a single "fat" EXE file that doesn't depend on any Qt DLL's. You will need to built Qt as static libraries yourself tough. The pre-compiled Qt binaries that you can download have been built as shared libraries. If you use these, your EXE file will depend on the Qt DLL's at runtime. But even then, the user does not need to "install" anything separately! You just need to ship the Qt DLL's along with your application...

    Last but not least, binaries compiled from C++ usually are platform-dependent. This is different from .NET's CIL or Java's Bytecode, which are platform independent and will run on any platform - as long as the required runtime (VM) is installed. C++ binaries only run on the platform they have been compiled for. Nonetheless C++ applications can be cross-platform as well. And a cross-platform framework like Qt makes this much easier. But still your C++ applications needs to be re-compiled from the sources for each target platform!



  • I see!
    Until now I somewhat thought the user had to download the libs themselves (install Qt SDK) unless you build static.

    I guess I'll go for the dynamic build then, thanks a lot.



  • The Qt SDK is for developers. The end-user does not need to install the SDK. Static vs. shared libraries makes no difference here. Only difference is that with the shared libraries you may need to ship some DLL files along with your EXE file, while static libraries can avoid these dependencies.

    See also:
    http://qt-project.org/doc/qt-4.8/deployment.html

    Also note that Dependency Walker is your friend:
    http://www.dependencywalker.com/


Log in to reply
 

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