This is the mail archive of the gcc@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]

Re: Question about <string.h>


On Mon, Jul 26, 1999 at 05:52:15PM -0400, "Steven W. Orr" <steveo@world.std.com> wrote:
> I want to use stpcpy in a program. The man page sez to include <string.h>
> When I do that, the compiler does *not* see the decl for stpcpy. The decl
> is surrounded by #ifdef __USE_GNU. Ok. So I rerun the compile with
> -D__USE_GNU. It doesn't help. In fact if I run with -dM to see what macros
> *are* defined I explicitly see that __USE_GNU is not defined.

You have to define -D_GNU_SOURCE while compiliung, and note that this

- makes your program run only on GNU platforms
- is not really a compiler question, but a libc question

I guess you are using glibc, which, by default, compiles your program
under -D_POSIX_SOURCE. This is to ensure that your program does not use
platform-dependent functions, except POSIX-ones. If you want another
"namepsace" you have to select it explicitly.

--  
      -----==-                                             |
      ----==-- _                                           |
      ---==---(_)__  __ ____  __       Marc Lehmann      +--
      --==---/ / _ \/ // /\ \/ /       pcg@goof.com      |e|
      -=====/_/_//_/\_,_/ /_/\_\       XX11-RIPE         --+
    The choice of a GNU generation                       |
                                                         |


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