Codeblocks macros

I want to print the line generated by the preprocessor:

cout << GITHASH << endl;

      

It works fine with app app from command line:

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

      

But if I put this macro in the compiler, define the parameter in the project build options, I get the following error:

Error: "dirty" was not defined in this scope

project build options

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

I am using code blocks 16.01 on ubuntu 16.04.

Edit: Now I want to replace the "dirty" git description for my project.

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

      

Any idea?

Edit:

It works with:

GITHASH=\\"`git describe --dirty --always --tags`\\"

      

+3


source to share


1 answer


Make sure that

GITHASH="\"dirty\""



written exactly as it is, there must be no space before or after = (equal sign).

Alternatively, try writing GITHASH=\"dirty\"

orGITHASH=\\"dirty\\"

+3


source







All Articles