Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a define to qmake WITH a value?

Tags:

qt

qmake

How do I add a define with qmake WITH a value:

For example, this does not work (as I expected) in my .pro file:

DEFINES += WINVER 0x0500 

nor

DEFINES += "WINVER 0x0500" 

How do I define WINVER as 0x0500 before anything starts compiling so it's definition is not affected in any way by compilation or include order?

like image 515
Jake Petroules Avatar asked Jul 27 '10 23:07

Jake Petroules


People also ask

What is qmake command?

qmake will run in win32 mode. In this mode, Windows file naming and path conventions will be used, additionally testing for win32 (as a scope) will succeed. This is the default mode on Windows. -d. qmake will output (hopefully) useful debugging information.

What is PWD in Qt?

$$PWD means the dir where the current file (. pro or . pri) is. It means the same in LIBS .

Where is qmake in Qt?

qmake.exe is in bin directory of your Qt installation folder (along with all the Qt dlls for deployment). Your compiler should be detected automatically (check the Tools > Options > Build & Run > Compilers tab).


2 Answers

DEFINES += "WINVER=0x0500" works for me.

This way, -DWINVER=0x0500 is added to the command line of the compiler, which is the syntax GCC/mingw expects for command line preprocessor definitions (see here for the details).

like image 114
Greg S Avatar answered Sep 28 '22 05:09

Greg S


DEFINES += MY_DEF=\\\"String\\\" 

This format is to be used when one intends to have the macro replaced by string element

like image 32
shrikantd Avatar answered Sep 28 '22 05:09

shrikantd