How do I figure out I can add a I would like to modify a version number on a string, but the only way that I would define as a copy wires of the version number to make sure you can get it to work is. The closest thing I could find was a method of quoting macro arguments, but it It does not work Does. without This works, but I do not like to define copies of this edition because I also need numbers in them. / P> classical C preprocessor question .... #define 'd rounded to a I'm trying to C using the preprocessor
#define 'The string GCC 4.1 solution on my compiler CentOS 5 should also work for MinGW.
#define s does not
#define MAJOR_VER 2 #define MINOR_VER 6 #define MY_FILE "/home/user/.myapp" #MAJOR_VER #MINOR_VER
# s does not work because these values are numbers and it will expand on
"/ home / user / .myapp". >, Which is not valid C .
#define MAJOR_VER 2 #define MINOR_VER 6 #define MAJOR_VER_STR "2" #define MINOR_VER_STR "6" #define MY_FILE "/home/user/.myapp" MAJOR_VER_STRING MINOR_VER_STRING
# defined STR_HELPER (X ) #x #define STR (X) STR_HELPER (x) #define MAJOR_VER 2 #define MINOR_VER 6 #define < P> Additional level of indirection will allow the preprocessor to expand macros before converting into wires.
Comments
Post a Comment