How to use qt5 static library?
-
I checked out qt5.7.0 source code from git via the following command
$ git clone https://code.qt.io/qt/qt5.git # cloning the repo
$ cd qt5
$ git checkout v5.7.0 # checking out the specific release or branch
$ git submodule update --init # updating each submoduleand built successfully via the following command
D:\JandunWork\qt5> configure.bat -prefix C:\Qt\Qt570_Static -static -debug-and-release -openssl -I C:\Libs\openssl_1.0.1j\include -L C:\Libs\openssl_1.0.1j\lib -opensource -confirm-license -make libs -nomake examples -nomake tests
D:\JandunWork\qt5> nmake
D:\JandunWork\qt5> nmake installQuestion One
How to configure my
Visual Studio 2015
orQt Creator
to program with qt5.7.0 static library? What I mean is that after I configureVisual Studio 2015
orQt Creator
I can simply create qt project via visual operationFile>New>Project
based on qt static library I built. It is as simple as using dynamic qt library installed from official setup.I can build my static qt application by adding include path, library path and library name for every project in
Visual Studio 2015
for every new project or by executingqmake *pro; nmake
in command prompt.Question Two
As you know, I can build my static qt application via
D:\JandunWork\Qt570StaticTestProject> qmake test.pro
D:\JandunWork\Qt570StaticTestProject> nmakeOddities happened to qt quick project while qt widget project worked well.
When I only useRectangle
QML Type, I got something like
.
It looks well, but when I tried to resize it, it became something like
.
What's worse,
ApplicationWindow
andWindow
QML Type cannot be rendered and I just got
.
So what's wrong with qt quick module from my static qt library? Or is it because I didn't use it in correct way?
If necessary I can provide with more information about my qt build configuration and test cases. Thanks for your patience. Any help is appreciated.
-
Hi,
You need to go to the settings. Add a new Qt version pointing to your static build and create a Kit to use it.
You should rather clone the latest 5.7, that way you'll have the bug fixes that went it in between.
-
Hi,
You need to go to the settings. Add a new Qt version pointing to your static build and create a Kit to use it.
You should rather clone the latest 5.7, that way you'll have the bug fixes that went it in between.
@SGaist said in How to use qt5 static library?:
Hi,
You need to go to the settings. Add a new Qt version pointing to your static build and create a Kit to use it.
You should rather clone the latest 5.7, that way you'll have the bug fixes that went it in between.
I had add Qt570_Static version manually as the following picture shows.
Please pay attention to the sentence
No qmlscene installed
. I have no idea whether it matters.After I added Qt570_Static version, there is a default kit as the following picture shows.
Obviously, there is something missing about this kit.
I create two project with this kit, but there are link errors when building.
Any advanced advice? Thank you in advance.
-
qmlscene is a helper tool which is not mandatory to build your applications.
AFAIK, that's a library from the DirectX SDK.
-
qmlscene is a helper tool which is not mandatory to build your applications.
AFAIK, that's a library from the DirectX SDK.