Codeblocks macros

Viewed 224

I want to print a string generated by the preprocessor:

cout << GITHASH << endl;

It works very well building the application from the command line:

g++ -DGITHASH="\"dirty\"" app.cpp -o app.o

But if I put this macro to codeblocks's compiler define setting in the project build options, I get following error:

Error: »dirty« was not defined in this scope

project build options

Does anyone know how to define this macro correctly in codeblocks settings?

I use codeblocks 16.01 on ubuntu 16.04.

Edit: Now I want to replace "dirty" with git description of my project.

GITHASH=\\"$(shell git describe --dirty --always --tags)\\"

Any idea?

Edit:

It works with:

GITHASH=\\"`git describe --dirty --always --tags`\\"
1 Answers
Related