CONFIG -=windows
QMAKE_LFLAGS += $$QMAKE_LFLAGS_WINDOWS
After use the previous commands the application works fine as I want.
But the problem is I don't know what the meaning of each command of these commands.
Can anybody explain each command of these commands?
The CONFIG variable specifies project configuration and compiler
options. The values will be recognized internally by qmake and have
special meaning. They are as follows.
[...]
The following options define the application/library type:
windows - The target is a Win32 window application (app only). The
proper include paths, compiler flags and libraries will automatically
be added to the project.
console - The target is a Win32 console application (app only). The
proper include paths, compiler flags and libraries will automatically
be added to the project.
Another excerpt from the manual: Operators
Operators
In many project files, the assignment (=) and append (+=) operators
can be used to include all the information about a project. The
typical pattern of use is to assign a list of values to a variable,
and append more values depending on the result of various tests. Since
qmake defines certain variables using default values, it is sometimes
necessary to use the removal (-=) operator to filter out values that
are not required.
The -= operator removes a value from the list of values in a variable:
DEFINES -= USE_MY_STUFF
The above line removes USE_MY_STUFF from the list of pre-processor
defines to be put in the generated Makefile.
So with CONFIG -= windows
you are removing the value windows
from the list of values in variable CONFIG
. Looks like windows
is among the default values of CONFIG
on your platform and you need to remove that value. The value windows
defines that your target is a Win32 window application. By removing it you declare that you would not like to have a Win32 window app. If your target is a Win32 console application instead then it is recommended to declare it explicitly: CONFIG += console
.
And now let's see QMAKE_LFLAGS += $$QMAKE_LFLAGS_WINDOWS
.
Excerpt from the manual: QMAKE_LFLAGS
QMAKE_LFLAGS
This variable contains a general set of flags that are passed to the
linker. If you need to change the flags used for a particular platform
or type of project, use one of the specialized variables for that
purpose instead of this variable.
[...]
QMAKE_LFLAGS_WINDOWS
This is used on Windows only.
This variable contains link flags when building Windows GUI projects
(i.e. non-console applications). The value of this variable is
typically handled by qmake or qmake.conf and rarely needs to be
modified.
This means that if you would like to change the flags then you should change either QMAKE_LFLAGS_CONSOLE
or QMAKE_LFLAGS_WINDOWS
. However you changed QMAKE_LFLAGS
directly by adding the value of QMAKE_LFLAGS_WINDOWS
which is strange because it contains link flags for building Win32 window apps and you declared with CONFIG -= windows
that you would not like to have a Win32 window app.
–
–
–
–
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.