Hi.
I have the following code in my application:
Code:
#define PORT 1234
#define HOST "http://example.com:1234"
Because the 1234 value appears in both definitions, I tried to concatenate the PORT to the HOST, so it would look like this:
Code:
#define PORT 1234
#define HOST "http://example.com:" PORT
When I try to compile the code everywhere where I used the HOST macro in some way the compiler gives me the following error:
"error: expected ‘)’ before numeric constant"
I guess this is because the PORT macro is an integer, the second is string, and when the compiler concatenates the two of them, converts the second macro to integer too.
Can somebody tell me, how can I get rid of this problem?
P.s.: If I define the PORT as string (#define PORT "1234") it is ok, but I would like to keep it integer.
Thank you.