Solaris 10: wchar_iso.h vs cwchar

Marc Glisse marc.glisse@inria.fr
Fri Sep 2 08:37:00 GMT 2011


On Fri, 2 Sep 2011, Maciej Bliziński wrote:

> Hello,
>
> While attempting to build PPL on Solaris 10 with gcc-4.6.1, I
> encountered a problem.  The first error looks like this:

Actually there is like a million other errors in there (those about limits 
are particularly noticable), I would say the gcc installation is broken. 
Maybe the new installation got mixed up with an old one? One way to check, 
compile a file containing #include <limits> with g++ -E file.cc and check 
the list of files that are read (c++config.h in particular).

> /opt/csw/lib/gcc/sparc-sun-solaris2.10/4.6.1/../../../../include/c++/4.6.1/cwchar:214:35:
> error: 'wchar_t* std::wcschr(wchar_t*, wchar_t)' conflicts with
> previous using declaration 'wchar_t* wcschr(wchar_t*, wchar_t)'
>
> From the following errors, it looks like there's a disagreement
> between these two header files:
>
> /usr/include/iso/wchar_iso.h
> /opt/csw/include/c++/4.6.1/cwchar
>
> The Solaris header says:
>
> #if __cplusplus >= 199711L
> (...)
> #else /* __cplusplus >= 199711L */
> extern wchar_t *wcschr(const wchar_t *, wchar_t);
> (...)
> #endif /* __cplusplus >= 199711L */
>
> while the GCC header:
>
> #ifndef __CORRECT_ISO_CPP_WCHAR_H_PROTO
>  inline wchar_t*
>  wcschr(wchar_t* __p, wchar_t __c)
>  { return wcschr(const_cast<const wchar_t*>(__p), __c); }
> (...)
> #endif

That's called overloading, and it isn't what g++ is complaining about.

> Do you have any advice?

When you install gcc, keep it simple, don't specify much more than 
--prefix.

-- 
Marc Glisse



More information about the Gcc-help mailing list