Is the QT DEFINES doing the same thing as #define in C++?

c++, qt

Solution

The items in the Qt Project file's `DEFINES` variable end up on the compiler's command line with the `-D` option (or whatever is appropriate for the compiler being used). To give your macro definition a value instead of merely defining it, use the following:

DEFINES += FOOBAR=foobar_value

That will show up on the compiler's command line as `-DFOOBAR=foobar_value`

If you need spaces you need to quote the value - and escape the quotes that'll be passed on the compiler command line:

DEFINES += FOOBAR="\"foobar value\""

This one shows up as: `-DFOOBAR="foobar value"`

Problem

What does the `DEFINES += includthisvariable` do in QT for a `.pro` file? If it works like the `#define` in C++, where is `includethisvariable` defined so that the preprocessor can replace `includethisvariable` with the value I set? I understand what `#define` does in c++ because you set the value beside what you define. However here it seems like you just list a name...The QT docs didn't help explain this for me.

Original source

Related problems