Boost logo

Boost :

From: Dave Abrahams (abrahams_at_[hidden])
Date: 1999-12-22 07:48:21


> Hi,
> Sorry to trouble the group with this, but I have a trivial program which I'm
> *sure* should work. But it doesn't on gcc (both mingw and Cygnus versions)
> on Win32, so I'm now worried. My confidence in these matters has taken a
> battering recently...
>
> Can somebody confirm that
>
> #include <string>
>
> int main()
> {
> std::char_traits<char> ctc;
> return 0;
> }
>
> should compile? Gcc gives an error
>
> C:\Library>c++ -fhonor-std -I\Applications\Mingw32\lib3\include test.cpp
> test.cpp: In function `int main()':
> test.cpp:5: `char_traits' undeclared in namespace `std'
> test.cpp:5: parse error before `>'
>
> But char_traits is declared, in <string>, to be in std::, isn't it? The
> standard says so...

1. I presume you're using gcc 2.95.2...

2. You might want to look at the header files that come with gcc to see if
char_traits is even implemented. Those libraries are woefully out-of-date.

3. Boris Fomitchev and I have found, in doing the latest STLPort for gcc,
that -fhonor-std doesn't actually work. Amazing as it may sound, std is
still (mis-)treated specially, though in slightly mysterious ways. That's
why the STLPort for gcc doesn't actually put anything in std. Instead,
everything goes into namespace stlport and the header files automatically do
    #define std stlport
for you.

4. Unlike earlier versions, the upcoming STLPort has a complete standard
library implementation, so it can act as a substitute for your outdated
library. I can probably send you an alpha version, if you care.

-Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk