How to build a project under the src directory of Qt? - c++

I found a .pro file 5.12.1\Src\qtbase\src\plugins\platforms\windows\windows.pro and opened it in Qt Creator. After configuring a MingW kit, I tried to build the project. But I got this error;
error: vulkan/vulkan.h: No such file or directory
#include <vulkan/vulkan.h>
Do I need to configure something before building the project? I do not want the vulkan support, just want to compile it successfully. I remember if I build the whole Qt src, I need to run a command like "configure xxxxx" in the src directory. Now I do not want to build whole Qt, just this project. There is a line in windows.pro that seems related to this problem.
qtConfig(vulkan): QT += vulkan_support-private
How should I do to remove the need for the vulkan stuff in order to build it successfully?

Yes, you will need to configure things. I suggest you read up on Building Qt 5 from source to understand what is involved.

Related

Qt: .pro file missing?

I tried to create a C++ project with Qt I stumbled across different kinds of guides which all refer to a special '.pro' file inside the project where I have to adjust a setting so the SQL part takes effect.
My problem: whenever I create a new project - doesn't matter whether its with qbs, qmake, or cmake - the project structure/ folder is lacking the '.pro' file.
Currently I'm using Qt 5.15.2 (via QT Creator) with MinGW Kit and cmake/ qbs.
As I'd like to play around with SQL-based apps.
Maybe I'm just skipping/ overlook something?
TL;DR: Use cmake. Forget about qbs and qmake.
Whenever I create a new project - doesn't matter whether its with qbs, qmake, or cmake - the project structure/ folder is lacking the '.pro' file.
A qmake project will have the .pro file, since that's the project file for qmake. Maybe you're looking in a wrong place? A qbs project will have a .qbs file, since that's what qbs uses. A cmake project will have CMakeLists.txt, since that's what cmake uses. It all works for me.
I'm just confused by all these guides stating that I have to add QT += widgets sql in the .pro file.
Those guides only apply when you use qmake, since .pro are qmake project files.
I suggest that you use cmake, as qbs is abandoned now, and there's no benefit to using Qt-specific qmake over the widely supported and continuously developed cmake.
Qt documentation covers the basics of how to use cmake to build Qt projects.
Qt support is provided natively by cmake, and it thus provides a comprehensive reference page.

Add QFTP module in qt5

i want to install QFTP module in my qt5
I downloaded it from github and i want to know what is the next step, if possible try to be the most explicit because my english is not very good, thanks
Did you try to open qtftp.pro file with QTCreator and then build it?
If this step is completed without errors, you can install the library to the main QT direcotry. Use the QT console window for this, which has all the paths embedded in it.
Go to the directory where you built the library and enter the command mingw32-make.exe install.
After that probably you can use your library in QT Creator by command:
QT += name_of_library

How to run qmake from the static Qt

For making a very simple Qt app "installable" on other systems, I'm using Qt Installer Framework following this link.
In bottom, in Setting up Qt Installer Framework, number 1 orders to have Qt Installer Framework source code. I downloaded it from here. (qt-installer-framework-opensource-2.0.1-src.zip)
Now I don't understand the next instruction there :(
It says:
2- Build the tools by running the "qmake" from the static Qt, followed by "make" or "nmake".
My question is, first what does it mean?
And from what path?
I don't know how to do it:(
qmake comes with the qt-framework and is a make file generator. (an alternative to cmake).
You call qmake on a .pro file from your project. This .pro file have to contain your source code files project dependencies and more.
Consider that you have a project folder with your source code and the .pro file. Then you call the qmake command in this folder. qmake is an program itself, which you can find in the bin folder of your qt-installation. If qmake is in your path variable, you go to the terminal, navigate to the specific folder and just write:
qmake
After that qmake will create a makefile. Then you could call makeand your program will be build.
I hope my answer helps you. You can learn more about qmake on the website of Qt. Here is also a very good qmake tutorial: klick
edit:
how to call make on windows:
download and install cygwin from
http://www.cygwin.com/setup-x86.exe - 32 bit installer or
http://www.cygwin.com/setup-x86_64.exe - 64 bit installer.
then start the Cygwin terminal (Cygwin.bat) and navigate to your folder and call
make
and that will build your qt-installer!

Generic c++ project in Qt creator - No rule to make target

I am trying to import a generic project into Qt creator by following this tutorial.
The project has its Makefile which builds multiple separate executables.
Running make all in the root directory of the project builds everything correctly.
The project has been imported into Qt creator and the sources show no errors regarding includes. When I press build, i get the error No rule to make targetall'. Stop.` As if the Makefile is non existent.
Where is Qt creator looking for the Makefile?
In my case the problem was with the custom build directory in the Build Settings.
Qt creator was searching for the Makefile in the build directory.
When using Qt creatror for Qt projects, I've usually set the build directory to something custom but this isn't sensible here :)

Is it possible to use Qt Creator without qmake?

I've heard that it is possible to build non-Qt applications (like simple C++ HelloWorld) with Qt Creator. I downloaded and installed Qt Creator, and tried to compile simple code with it. But I didn't succeed: Creator needs qmake to create makefile.
Although the package I downloaded includes MinGW, there is no qmake inside of it.
I still want to use it just like an IDE to create simple C++ sources and compile them with MinGW. Is it possible to use Qt Creator without installing whole platform?
Qt Creator support CMake projects, you just need to choose Open a file or project and select the root CMakeList.txt of your project.
If you want to define your own build workflow, you can remove the default build step and create your own custom build steps (Qt Creator Build Steps).
I think you can modify the build step to remove qmake and use your custom make file.
You totally can!
You can write a .pro file yourself and use it as a project file to use QtCreator without linking / using any of the Qt libraries.
In Project / Compilation Parameters, you can actually tune the compilation steps (removing the qmake step and adding your own).
I use it for a big project of mine and it's very efficient: QtCreator's C analyzer is diamond.
Here's a sample project file for me:
TEMPLATE = app
TARGET =
DEPENDPATH += . include
INCLUDEPATH += . include
# Input
HEADERS += include/x.h \
include/y.h \
include/z.h
SOURCES += src/x.cpp
Note that I actually use qmake to generate this file automatically, but you can also put your hands into it and modify it by hand.
Afterwards, it's only a matter of $ qtcreator yourfile.pro.