Reputation: 43662
I have a file named header1.h with the following code
#include "string.h"
namespace custom1
{
#define MYMACRO(f, z) strrchr(f, z)
}
but now I'm getting compilation errors with gcc like
OtherHeader.h error: there are no arguments to ‘strrchr’ that depend on a template parameter, so a declaration of ‘strrchr’ must be available [-fpermissive]
Why isn't the "string.h" inclusion visible? Can another file do this
namespace custom1
{
is MYMACRO visibile here?
}
?
Why am I getting the depend error?
Upvotes: 0
Views: 76
Reputation: 874
The signature of the strrchr function is
char *strrchr(const char *s, int c);
so I think you are just missing an argument.
Upvotes: 0
Reputation:
Preprocessor macros have no notion of namespaces, they do 'global text processing', always.
Upvotes: 1