Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
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?
You would first need to also build Qt statically on windows
Thanks for the reply.
Moreover, After resolve the last error.
My application is running with qt But it is not running with out qt.
An error occured "Qt5widgets.dll not found".
I go through lots of forum but not able to resolve it.
IamSumit last edited by
if you are going to run .exe (without qt) you need to copy a file
“Qt5widgets.dll from C:\Qt\Qt5.0.1\5.0.1\bin:
and paste it to release folder .
Even this method is not working..
i copied .dll file from C:\Qt\Static\5.2.0\bin\5.0.2\msvc2010\bin to release folder
IamSumit last edited by
this could provide you more help
MuldeR last edited by
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.
Thanks for your reply..
Now I got fresh machine with windows 7 and visual studio 2010.
Can anybody Share any link to install static Qt on windows or way to install fresh Qt.
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
guidupas last edited by
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
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 -MTd
and save it.
Open the Visual Studio command prompt and navigate to QTDIR
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
- 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.