Hi,
I have a piece of code as pasted below.
I get warnings like
test1.c:29:32: warning: pasting "(" and ""ERROR:"" does not give a valid preprocessing token
test1.c: In function `main':
test1.c:29: `__MODULE__' undeclared (first use in this function)
test1.c:29: (Each undeclared identifier is reported only once
test1.c:29: for each function it appears in.)
What does warning: pasting "(" and ""ERROR:"" does not give a valid preprocessing token mean?
And where is __MODULE__ defined?
Please provide me some solution.
Taklu.
--------------------------------------------------------
#include <stdio.h>
#include <stdarg.h>
#define DL1 "%s:"
#define DR1 ,__MODULE__
#define DL2 "%d:"
#define DR2 ,__LINE__
void Trace(char *format, ...);
#define Debug(ARGS...) Trace(##ARGS)
#define Error(ARGS,...) \
Debug("ERROR:"DL1 DL2 ARGS "\n" DR1 DR2, ## __VA_ARGS__)
void Trace(char *format, ...){
va_list args;
va_start(args, format);
vprintf(format, args);
va_end(args);
return;
}
main(){
int i = 10;
Error("Print from main");
return 0;
}