Question about gcc-4.4.4

ali hagigat hagigatali@gmail.com
Tue Aug 31 15:53:00 GMT 2010


I tested it and the program can be executed correctly. It is only a
warning message you got, Andrew. C compiler is finding a printf
function prototype some how and the linker links libc automatically.

How compiler adds a declaration for printf, how it can acquire such information?


On Tue, Aug 31, 2010 at 1:55 PM, Andrew Haley <aph@redhat.com> wrote:
> On 08/31/2010 10:15 AM, Pavel V Samsonov wrote:
>> Good day!
>> I use gcc-4.4.4 to compile C code. When I use glibc functions and miss
>> include headers, gcc still compile code. For example:
>>
>>
>> /*#inclide <stdio.h>*/
>> int main()
>> {
>>       printf("printf");
>>       return 0;
>> }
>>
>> This mean that gcc not verify presence of function "printf" before
>> linking stage?
>
> That's not what happens to me.  I get:
>
>  $ gcc t.c
> t.c: In function 'main':
> t.c:4: warning: incompatible implicit declaration of built-in function 'printf'
>
> Andrew.
>
>



More information about the Gcc-help mailing list