How do I specify compilation flags for g++`in Qt Creator 3.3.2?
Good time of day! I have a question.
How do I specify compilation flags for g++
in Qt Creator? Not for qmake, but for g++. Is there any way to specify them other than by writing them in the. pro project file?
2 answers
There is a way. You need to find the specification file .spec
from your Qt kit inside qt (the file name is written on the Projects->Build tab, under "Build Stages") it uses qmake
when generating Makefile
In this file, you need to add the option.
Try running the program qtcreator
by passing it an environment variable with the value you need:
QMAKE_CXXFLAGS="флаги" qrcreator
Supplement
If you want such a variable to always be present in the environment, you can add its purpose (as a new line at the end of the file), for example, to the file ~/.bashrc
, adding the directive export
:
export QMAKE_CXXFLAGS="флаги"
And in order for this variable to be present in graphics programs, you can also add this line, for example, to the file ~/.xsessionrc
.