|
Boost Users : |
From: Dave Shawley (daveshawley_at_[hidden])
Date: 2002-10-09 23:07:24
> "Christopher Henrich" <chenrich_at_[hidden]> wrote:
> > This bug comes up when I try to include <boost/array.hpp> in certain
> > CodeWarrior projects.
> ...
> > Error: undefined identifier 'ptrdiff_t'
> ...
>
> I get this too when using Code Warrior for PlayStation2 with
> <boost/smart_ptr.hpp>.
>
> It appears that the compiler-supplied <cstddef> simply contains #include
> <stddef.h>, so ptrdiff_t is not getting defined in the std namespace. Doing
> this:
>
> namespace std{using ::ptrdiff_t;}
> #include <boost/smart_ptr.hpp>
>
> fixes it, but I'm not sure that this is strictly allowed.
>
> If anybody knows a better fix, please let me know.
>
> Martin.
>
> Info: <http://www.boost.org>
> Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
> Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>
>
I've been wondering how they got around this problem in MSVC6 since
it doesn't place any of the ``C'' symbols in std::. If you look
closely in the config directory there is a config directive called
BOOST_NO_STDC_NAMESPACE that fixes this problem with that exact
solution. Well something *really* close:
#ifdef BOOST_NO_STDC_NAMESPACE
# include <cstddef>
namespace std { using ::ptrdiff_t; using ::size_t; }
#endif
That is from boost/config/suffix.hpp. I think that I have v 1.28.0
but I moved it to c:\boost so that I can upgrade w/o changing all
of my include paths.
Anyway, to make a long story short, you probably want to add
BOOST_NO_STDC_NAMESPACE to either user.hpp or modify
boost/config/compiler/metrowerks.hpp to correctly set it based on
whatever compiler defines are in effect.
- Dave
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net