From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <199606171621.JAA27188@koala.azstarnet.com> Date: Mon, 17 Jun 1996 09:21:42 -0700 From: David Mosberger-Tang Subject: Re: string.h, strlen(), warnings from gcc >>>>> 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 for the following simple >> example? >> >> fresco@banshee:/tmp $ cat a.c #include >> >> /*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