Escaping a # symbol in a #define macro?
c, c++, c-preprocessor, macros, preprocessor-directive
Solution
As far as I remember you cannot use another preprocessor directive in define.
Problem
Without going into the gory details I want to use a `#define` macro that will expand to a `#include` but the '#' sign is confusing the preprocessor (as it thinks I want to quote an argument.) For example, I want to do something like this: ``` #define MACRO(name) #include "name##foo" ``` And use it thus: ``` MACRO(Test) ``` Which will expand to: ``` #include "Testfoo" ``` The humble # sign is causing the preprocessor to barf. MinGW gives me the following error: `'#' is not followed by a macro parameter` I guess I need to escape the # sign but I don't if this is even possible. Yes, macros are indeed evil...