Qt Statically build on Windows
-
I have created an applications on Linux and have built them statically successfully.
I am trying to do the same thing in windows but I am not able to build staticaly.
I have installed the QtSDK and designed my application in the QtCreator in Windows. The compiler I am using is MSVC2010 32bit.
First of all i get the error " Failed to start program. Path or permissions wrong?"
What is the proper way to resolve this error?
-
Hi,
You would first need to also build Qt statically on windows
-
Hii
this could provide you more help
http://qt-project.org/wiki/Deploy_an_Application_on_Windows -
If you really built Qt as "static" libraries - which you need to do yourself (since the "official" pre-compiled Qt binaries are always "shared") - and if you link your application against all the relevant "static" libraries, then the resulting executable won't depend on any Qt DLL's at runtime.
But if you get a message like “Qt5widgets.dll not found”, it means you did not build your application with "static" Qt libraries. Also it means that “Qt5widgets.dll" (or some additional DLL required by that DLL) is missing in your DLL Search Path. See "Dynamic-Link Library Search Order":http://goo.gl/VA8yC!
Finally, I highly recommend using the awesome "Dependency Walker":http://www.dependencywalker.com/ tool to resolve your DLL dependency issues.
-
There's no static Qt installer, you have to do that yourself.
For a standard install just go to the download page and get the e.g. the online installer. Choose the VS2010 packages when selecting what to install
-
There are softwares that recognize what libraries you need to run the app out. "Dependency walker":http://www.dependencywalker.com/ is a good one.
You can also use installers like "Inno Setup":http://www.jrsoftware.org/isinfo.php
Cheers
-
Hello everyone,
I followed the following steps using source code of Qt 4.7.3.
-
I have installed the visual-studio-add-in
-
Extract the Qt source code to C:\qt\4.7.3.static
-
Add the folder above to environment variables
QTDIR = C:\qt\4.7.3.static
Also append the qt location to path variable
-
Then Change the target configuration.
Edit the file mkspecs\win32-msvc2010\qmake.conf and replace
QMAKE_CFLAGS_RELEASE = -O2 -MD with -O2 -MT
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MD -Zi with -O2 -MT -Zi
QMAKE_CFLAGS_DEBUG = -Zi -MDd with -Zi -MTdand save it.
-
Open the Visual Studio command prompt and navigate to QTDIR
-
Run configure
configure -static -debug-and-release -opensource -no-qt3support -qt-sql-sqlite -phonon -phonon-backend -platform win32-msvc2010
Accept the license with ‘y’ and wait while Qt is getting configured.
- Run nmake to start compiling
nmake
- Start VS2010
Go to Qt-> Qt-Options add the just compiled Qt version found within the QTDIR folder.
Now I can compile Qt code using Microsoft Visual Studio.
It compile Statically.It is working as a option of Microsoft Visual Studio.
-
-
Before changing MD to MT, please read carefully about the implications from doing it.