Qt Statically build on Windows
-
wrote on 5 Jun 2014, 06:08 last edited by
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
-
wrote on 6 Jun 2014, 04:53 last edited by
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. -
wrote on 6 Jun 2014, 05:04 last edited by
Hiii.
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 . -
wrote on 6 Jun 2014, 05:33 last edited by
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
-
wrote on 6 Jun 2014, 05:58 last edited by
Hii
this could provide you more help
http://qt-project.org/wiki/Deploy_an_Application_on_Windows -
wrote on 6 Jun 2014, 11:19 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.
-
wrote on 18 Jun 2014, 06:11 last edited by
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
-
wrote on 18 Jun 2014, 14:41 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
Cheers
-
wrote on 1 Jul 2014, 04:42 last edited by
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.