R
ritesh
Hi,
I'm compiling the following code on linux/cc and keep getting a
compiler error
"attrib.c:4: syntax error before '{' token"
I'm using the following options to compile -
cc -Wall -c attrib.c
#include "stdio.h"
void myprintf(const char *format, ...) __attribute__((format(printf,
1, 2)))
{
printf(format);
}
int main()
{
myprintf("s=%s \n", "hello");
return 0;
}
I had just learned about this __attribute__ mechanism and was trying it
out for the first time. Is there a problem with the way the
__attribute__ portion of the code is written?
Regards,
Ritesh Kapoor
I'm compiling the following code on linux/cc and keep getting a
compiler error
"attrib.c:4: syntax error before '{' token"
I'm using the following options to compile -
cc -Wall -c attrib.c
#include "stdio.h"
void myprintf(const char *format, ...) __attribute__((format(printf,
1, 2)))
{
printf(format);
}
int main()
{
myprintf("s=%s \n", "hello");
return 0;
}
I had just learned about this __attribute__ mechanism and was trying it
out for the first time. Is there a problem with the way the
__attribute__ portion of the code is written?
Regards,
Ritesh Kapoor