This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question about gcc-4.4.4


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.
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]