[Bug libstdc++/80340] error: 'write' was not declared in this scope

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Apr 6 12:39:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80340

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |INVALID

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Sumit from comment #5)
> (In reply to Jonathan Wakely from comment #4)
> > (In reply to Jonathan Wakely from comment #2)
> > > Configuring GCC with --disable-libstdcxx-verbose will remove the use of
> > > write in that file
> 
> Is this flag --disable-libstdcxx-verbose enabled because
> "--disable-libstdcxx-pch" is configured in my configuration?

It's not enabled. I'm suggesting that you enable it, it will solve your
problem.


(In reply to Sumit from comment #6)
> If I do not configure for hosted environment by using
> --disable-hosted-libstdcxx, I did not see this error.
> 
> Any clues?

Isn't the code a pretty big clue?

#if _GLIBCXX_HOSTED && _GLIBCXX_VERBOSE
#ifdef _GLIBCXX_HAVE_UNISTD_H
# include <unistd.h>
# define writestr(str)  write(2, str, sizeof(str) - 1)
# ifdef __GNU_LIBRARY__
  /* Avoid forcing the library's meaning of `write' on the user program
     by using the "internal" name (for use within the library).  */
/*#  define write(fd, buf, n)   __write((fd), (buf), (n))*/
# endif
#else
# include <cstdio>
# define writestr(str)  std::fputs(str, stderr)
#endif
#else
# define writestr(str) /* Empty */
#endif

If you use --disable-hosted-libstdcxx or --disable-libstdcxx-verbose then
there's no call to ::write

Please stop trying to use Bugzilla to find out how to configure an unsupported
version GCC for your target. This is not the right place.


More information about the Gcc-bugs mailing list