How to add preprocessor directive into .pro ?
-
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
@AnneRanch
For "preprocessor directive",.profiles can have their own variables if that is what you have in mind viaTEST = 1See https://stackoverflow.com/questions/7754218/qmake-how-to-add-and-use-a-variable-into-the-pro-file.
-
@AnneRanch
For "preprocessor directive",.profiles can have their own variables if that is what you have in mind viaTEST = 1See https://stackoverflow.com/questions/7754218/qmake-how-to-add-and-use-a-variable-into-the-pro-file.
@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....
@AnneRanch
DEFINES += TEST_DEFINEshould cause
-DTEST_DEFINEto be added to compiler command line.
https://doc.qt.io/qt-6/qmake-variable-reference.html#defines -
@AnneRanch
DEFINES += TEST_DEFINEshould cause
-DTEST_DEFINEto be added to compiler command line.
https://doc.qt.io/qt-6/qmake-variable-reference.html#defines@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?
@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
DEFINESare 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_DEFINEsomewhere on the command line if your.prohas theDEFINES += TEST_DEFINEexample. -
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