J
James H. Markowitz
This may be an easy one for those who know, but I just can't
figure it out.
I have a source file S.c that will be compiled twice into the
same executable. In one occasion it is compiled with the compile time
macro definition -DMY_MACRO=abc, whereas in the other the macro
definition is -DMY_MACRO=xyz.
Inside S.c I'd like to have a line of code such that as a result
of the first compilation it would print out
"MY_MACRO is abc."
whereas for the other it would print out
"MY_MACRO is xyz."
Something like
printf("MY_MACRO is %s.", MY_MACRO) ;
does not work, because abc and xyz are not strings. I had a go with the
stringification feature, but so far without success.
Suggestions?
figure it out.
I have a source file S.c that will be compiled twice into the
same executable. In one occasion it is compiled with the compile time
macro definition -DMY_MACRO=abc, whereas in the other the macro
definition is -DMY_MACRO=xyz.
Inside S.c I'd like to have a line of code such that as a result
of the first compilation it would print out
"MY_MACRO is abc."
whereas for the other it would print out
"MY_MACRO is xyz."
Something like
printf("MY_MACRO is %s.", MY_MACRO) ;
does not work, because abc and xyz are not strings. I had a go with the
stringification feature, but so far without success.
Suggestions?