How to add preprocessor directive into .pro ?
-
wrote on 26 Dec 2022, 16:26 last edited by
Is there a way to add preprocessor directive into QT project ( x.pro) file?
is used to comment out the line , hence
( and tick tack toe marks the line to do unwanted formatting here...)
#define TEST
wouldn't do much
-
Is there a way to add preprocessor directive into QT project ( x.pro) file?
is used to comment out the line , hence
( and tick tack toe marks the line to do unwanted formatting here...)
#define TEST
wouldn't do much
wrote on 26 Dec 2022, 16:48 last edited by@AnneRanch
For "preprocessor directive",.pro
files can have their own variables if that is what you have in mind viaTEST = 1
See https://stackoverflow.com/questions/7754218/qmake-how-to-add-and-use-a-variable-into-the-pro-file.
-
@AnneRanch
For "preprocessor directive",.pro
files can have their own variables if that is what you have in mind viaTEST = 1
See https://stackoverflow.com/questions/7754218/qmake-how-to-add-and-use-a-variable-into-the-pro-file.
wrote on 26 Dec 2022, 19:10 last edited by Anonymous_Banned275@JonB Per doc , i tried this
DEFINES += #define TEST_DEFINE
no go
Doc does not help - used their example....
-
@JonB Per doc , i tried this
DEFINES += #define TEST_DEFINE
no go
Doc does not help - used their example....
wrote on 26 Dec 2022, 19:46 last edited by JonB@AnneRanch
DEFINES += TEST_DEFINE
should cause
-DTEST_DEFINE
to be added to compiler command line.
https://doc.qt.io/qt-6/qmake-variable-reference.html#defines -
@AnneRanch
DEFINES += TEST_DEFINE
should cause
-DTEST_DEFINE
to be added to compiler command line.
https://doc.qt.io/qt-6/qmake-variable-reference.html#defineswrote on 27 Dec 2022, 15:40 last edited by@JonB Could you kindly tell me WHERE in QT Creator I can read compiler options?
-
@JonB Could you kindly tell me WHERE in QT Creator I can read compiler options?
wrote on 27 Dec 2022, 17:26 last edited by@AnneRanch
I don't have Creator to hand. There will be somewhere in "Build" where it tells you what compiler options it uses.Even there you might not be shown what your
DEFINES
are set to/what it will pass to the compiler. I would run a compilation and look at the actual command line being executed which it shows in one of the tabs at the bottom, "Compile" or "Build" Output or similar. There I would expect/hope to see it actually passing-DTEST_DEFINE
somewhere on the command line if your.pro
has theDEFINES += TEST_DEFINE
example. -
wrote on 31 Dec 2022, 00:23 last edited by
SOLVED
putting
DEFINES += define DEBUG
in main .pro file
has same effect as putting in
#define DEBUG
here is a snippet of compiler output?
clang++ -c -pipe -g -std=gnu++1z -Wall -Wextra -fPIC -D_REENTRANT **-Ddefine -DDEBUG** -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_BLUETOOTH_LIB -DQT_NETWORK_LIB -DQT_DBUS_LIB -DQT_CORE_LIB -I. -I/home/nov25-1/Qt/Nov26/6.5.0/gcc_64/include -I/home/nov25-1/Qt/Nov26/6.5.0/gcc_64/include/QtWidgets -I/home/nov25-1/Qt/Nov26/6.5.0/gcc_64/include/QtGui -I/home/nov25-1/Qt/Nov26/6.5.0/gcc_64/include/QtBluetooth -I/home/nov25-1/Qt/Nov26/6.5.0/gcc_64/include/QtNetwork -I/home/nov25-1/Qt/Nov26/6.5.0/gcc_64/include/QtDBus
1/7