I'm trying to define a macro. The idea is that when it expands, it'll include a header. For example:
#define function() \
include <CustomHeader.h>
Thanks a lot.
I'm trying to define a macro. The idea is that when it expands, it'll include a header. For example:
#define function() \
include <CustomHeader.h>
Thanks a lot.
This can't be done.
That particular quote is from a reasonably recent draft of the C++ standard, but with minor changes in wording, the same basic idea has been around nearly forever.
As others have pointed out, you cannot produce a directive from a macro.
You can however produce the argument to a directive from a macro:
But you can't get rid of that explicit
#include
, or insert it into the middle of a different line, or anything like that.