How to associate a number with a string in a macro?

I want to associate the version number with a string in the inno-setup preprocessor macros. I tried using the stringer trick (used in C ++ macros) as follows:

#define stringer_helper(arg) #arg #define stringer(arg) stringer_helper(arg) #define version 1 #define myapp "lala " + stringer(version) 

but get the error:

 Illegal character in input file: '#' (0x23) 

How can I add a numerical definition to define a string?

+6
source share
1 answer

You can use the Str function to drive an integer variable:

 #define MyString "Text" #define MyInteger 666 #define MyVariable MyString + Str(MyInteger) 
+8
source

Source: https://habr.com/ru/post/983919/


All Articles