PDA

View Full Version : Pre-processor Settings



Atomic_Sheep
1st May 2021, 06:50
I had a look through Tools->Options but I couldn't find any options for generating output after the pre-processor step to see what the outcome of that step is. Is there an option somewhere that I missed or does Qt not have this option. On VS there is an option to produce a post processor file.

ChrisW67
1st May 2021, 09:27
I had a look through Tools->Options but I couldn't find any options for generating output after the pre-processor step to see what the outcome of that step is. Is there an option somewhere that I missed or does Qt not have this option. On VS there is an option to produce a post processor file.
Qt is a set of libraries, not an IDE or compiler.

I am going to guess you are attempting to compile on Windows using Microsoft's C++ compiler, in which case you need to pass the compiler the /P and possibly /C or /Fi options (https://docs.microsoft.com/en-us/cpp/build/reference/p-preprocess-to-a-file?view=msvc-160) (-P) to get a foobar.i from your foobar.cpp. This option will terminate the compilation after pre-processing. This should be enough for debugging purposes.


If you are using qmake to control your build then you can put these options in:


QMAKE_CFLAGS += /P /C
QMAKE_CXXFLAGS += /P /C

You might find the pre-processed output in the foobar.obj as a side-effect of the way qmake invokes the compiler

If you are using a GCC compiler the equivalent option is -E. Options Controlling the Preprocessor (https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html)

Atomic_Sheep
9th May 2021, 05:07
I always call Qt Creator Qt. I think you made the distinction clear now.