Hallo!
Ich würde gerne einen URL-Pfad per Marko zu Compilezeit erstellen.
1 | #define PASTER2(x,y) x ## y
|
2 | #define EVALUATOR2(x,y) PASTER2(x,y)
|
3 |
|
4 | #define PASTER3(x,y,z) x ## y ## z
|
5 | #define EVALUATOR3(x,y,z) PASTER3(x,y,z)
|
6 |
|
7 | #define SERVER "http://marity.com:"
|
8 | #define SERVER_PORT 8080
|
9 | #define URL EVALUATOR2(SERVER, SERVER_PORT)
|
10 |
|
11 | const char* url = URL;
|
Beim Kompilieren bekomme ich folgende Fehlermeldung:
error: pasting ""http://marity.com:"" and "8080" does not give a valid
preprocessing token
Auffallen tun die zwei "" beim Server. Nur wenn ich beim Makro die
Anführungszeichen weg lasse kann er das Makro nicht ausführen, da das
"//" anscheinend als Kommentar interpretiert wird.
1 | #define SERVER http://marity.com:
|
Wie bekomme ich das Dilemma gelöst?
Danke und Grüße
JJ