From: David Mosberger-Tang <davidm@AZStarNet.com>
Subject: Re: string.h, strlen(), warnings from gcc
Date: Mon, 17 Jun 1996 09:21:42 -0700 [thread overview]
Message-ID: <199606171621.JAA27188@koala.azstarnet.com> (raw)
>>>>> On Mon, 17 Jun 1996 12:04:10 +0200 (MET DST), koenig@tat.physik.uni-tuebingen.de (Harald Koenig) said:
>> Can anyone explain why I should need to explicitly specify extern
>> strlen() after including <string.h> for the following simple
>> example?
>>
>> fresco@banshee:/tmp $ cat a.c #include <string.h>
>>
>> /*extern size_t strlen(const char *ptr);*/
>>
>> size_t z(const char *y) { return strlen(y); } fresco@banshee:/tmp
>> $ cc a.c a.c: In function `z': a.c:7: warning: type mismatch in
>> implicit declaration for built-in function `strlen'
Harald> for such problems I usually check the preprocessor output
Harald> if/where the prototype is declared and which include files
Harald> are really included:
Harald> cc -E a.c | more
Harald> looking for "strlen" and/or filenames of include files...
An extra cent: gcc -g3 -E a.c is very handy, since it'll show all the
#defines etc. as well.
--david
next reply other threads:[~1996-06-17 16:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-06-17 16:21 David Mosberger-Tang [this message]
[not found] <Pine.LNX.3.91.960617181918.17165A-100000@chaos.chaos.org.uk>
1996-06-17 20:51 ` string.h, strlen(), warnings from gcc Richard Henderson
[not found] <Pine.SUN.3.90.960617020120.8650B-100000@ant>
1996-06-17 3:28 ` Richard Henderson
1996-06-17 17:22 ` David Fell
1996-06-17 10:04 ` Harald Koenig
-- strict thread matches above, loose matches on Subject: below --
1996-06-17 1:04 David
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox