If you are linking with gnu tools, add _GNU_SOURCE to your defines and it should work.
Yup! That was it. Thanks 10E6.
Well, I'm seeing the same problem now.
Are you using icc?
Where did you put the
tekubasx@marc004:~/C_programs$ cat mysscanf.c
sscanf( str, "%d", &temp);
printf("temp: %d \n",temp);
printf("str: %s \n",str);
tekubasx@marc004:~/C_programs$ icc -static -mcpu=pentium -gnu-version=340 mysscanf.c
/tmp/iccGedbm9.o(.text+0x2a): In function `main': : undefined reference to `__isoc99_sscanf'
tekubasx@marc004:~/C_programs$ which icc
I added it to the makefile (-D_GNU_SOURCE) so it'd be defined wherever it needed it, so my code wouldn't have to change.
Thanks. Very neat. Putting in the actual C file does not appear to work but
icc -D_GNU_SOURCE -static -gnu-version=340 -mcpu=pentium mysscanf.c
I find that strange but whatever works.
The #define _GNU_SOURCE works if put directly in the code if you put it before the header includes.