[LLVMdev] CommandLine.cpp:189: error: `strdup' undeclared

Brian R. Gaeke gaeke at uiuc.edu
Tue Jul 6 15:02:00 PDT 2004


In that case, I wonder if defining _ALL_SOURCE on the g++ and gcc
command lines, and rebuilding, would help?  If it does help, we
can add a check for __INTERIX that automatically adds _ALL_SOURCE.

-Brian Gaeke

> >#if defined(_ALL_SOURCE)  \
> >	    || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE_EXTENDED==1)) \
> >	    || (__STDC__ - 0 == 0 && !defined(_POSIX_C_SOURCE))
> >extern char* __cdecl strdup(const char *);
> >#endif /* defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE_EXTENDED == 1) */
> >
> 
> (RTFM) Some of the above macros and their meaning can be found in Interix' 
> UNIX Application Migration Guide, chapter 10. An excerpt:
> 
> "To add or isolate code that implements Interix-specific features, surround 
> it with #ifdef __INTERIX ..."
> 
> "The __INTERIX macro is automatically defined to be true (1) by ... the gcc 
> compiler. ... Micosoft Visual C++ compiler ... defines __STDC__, unless -N 
> nostdc is specified."
> 
> "The Interix header files are structured to align with the Single UNIX 
> Specification. For example, string and memory functions that occur in 
> POSIX.1 are in string.h. String and memory functions that are in the Single 
> UNIX Specification, but not in POSIX.1, are in strings.h. ...
> 
> To get all of the APIs provided with the Interix SDK, define the 
> _ALL_SOURCE value as 1 before the first header file is included ..."
> 
> "If the source is not defined, the default is the more restrictive 
> _POSIX_SOURCE."
> 
> The meaning of the other macros may be defined by autoconf?




More information about the llvm-dev mailing list