Quantcast
Channel: The Zeroth! » kde
Viewing all articles
Browse latest Browse all 10

How to use Qt’s .pro file variable in C++ code

$
0
0

So today my colleague ask me ” I have a variable VERSION in .pro file (qmake project file) I want to use that variable in my C++ code, How to do that?”

After a little search on Google I figured that we have export project files variable as a macro for C/C++ code and it very easy.

As the per problem we want VERSION variable in C++ code. So in  project file we write

DEFINES += VERSION=\\\"$$VERSION\\\"

and in C/C++ code just

qDebug()<< VERSION ;

this is just a awesome.


Viewing all articles
Browse latest Browse all 10

Trending Articles