This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
std=c99 and strdup
- From: Jeffrey Walton <noloader at gmail dot com>
- To: GCC Users List <gcc-help at gcc dot gnu dot org>
- Date: Fri, 14 Oct 2011 18:54:20 -0400
- Subject: std=c99 and strdup
- Reply-to: noloader at gmail dot com
Hi All,
I'm getting "warning: implicit declaration of function ‘strdup’".
The man pages tell me to include string.h. In string.h (which is included):
#if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
/* Duplicate S, returning an identical malloc'd string. */
extern char *strdup (__const char *__s)
__THROW __attribute_malloc__ __nonnull ((1));
#endif
I feel like I'm missing something since strdup is guarded with
library/operating system macros. Can anyone point out my mistake? Or
should I just declare it extern myself?
Jeff