Hi! I have to compile code for an assignment with the gcc options -Wall -pedantic.
there must not be warnings in order to submit it, so here there's the output
Code:
[cls2@it151 DPLAN]$ gcc -Wall -pedantic lbase.c
lbase.c: In function ‘convertiEvento’:
lbase.c:66: warning: ISO C90 forbids mixed declarations and code
lbase.c:67: warning: implicit declaration of function ‘snprintf’
lbase.c:67: warning: incompatible implicit declaration of built-in function ‘snprintf’
/usr/lib/gcc/i386-redhat-linux/4.3.2/../../../crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
The main is in another file so the problem is only with the snprintf().
I had a look to the man page of snprintf:
Code:
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
snprintf(), vsnprintf(): _BSD_SOURCE || _XOPEN_SOURCE >= 500 ||
_ISOC99_SOURCE; or cc -std=c99
I tried to define those variables but unfortunately the warning is still there!
Any idea?
Cheers