I am trying to use my own printf function so i don't want to include standard include files... so I am compiling my code with -nostdinc
I have created my program something like this:
extern int printf(const char*,...); printf("Value:%d",1234); //printf("\n"); It is working fine for this code, but when I use printf("\n") then it is showing undefined reference to 'putchar'.
If i comment printf("\n"); then nm command is showing
$ nm test1.o U exit 00000000 T main U printf 00000030 T _start but if I use printf("\n"); then nm command is showing
$nm test1.o U exit 00000000 T main U printf U putchar 0000003c T _start I am not getting how and from where putchar is getting included
gcc version 4.8.2 (GCC)
printf?putcharwhen i use-nostdinc-nostdlibalso at the time of linking then i am getting undefined reference to 'putchar'.