#define STR_L(x) #x
#define STR(x) STR_L(x)
#define CAT_L(x,y) x##y
#define CAT(x,y) CAT_L(x,y)
#define FOLDER folder/
#define PLATINCLUDE(x) STR( CAT(FOLDER ,x) )
#include PLATINCLUDE(file.h) // results in #include "folder/file.h"
That works on GCC and MSVC. However Clang is stupid, it seems to understand that code and knows it's correct, but it just breaks...
So, if the file does not exist, it complains that #include "folder/file.h"
points to a non-existing file (as expected), but if the file exists it gives the following:
Pasting formed '/file', an invalid preprocessing token
Any workaround for this?