This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: problems compiling under c++ 3.4
- From: Travis Spencer <travislspencer at gmail dot com>
- To: MIGUEL GONZALEZ CASTANYOS <mgc at tid dot es>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 6 Jul 2005 08:08:42 -0700
- Subject: Re: problems compiling under c++ 3.4
- References: <73499e72facd.72facd73499e@tid.es>
- Reply-to: Travis Spencer <travislspencer at gmail dot com>
On 7/6/05, MIGUEL GONZALEZ CASTANYOS <mgc@tid.es> wrote:
> I am compiling a C++ code a colleague sent me with some references to
> string.h library.
Are you include string.h or cstring? You say string.h here, but the
errors below say cstring. So, I'm a little confused.
> He compiled the code in gcc-3.4.1 under Mandrake. I am trying to do the
> same using gcc-3.4.2 under Debian but I got these errors:
>
> > In file included from /usr/include/c++/3.4/cstring:49,
> > from /usr/include/c++/3.4/bits/char_traits.h:45,
> > from /usr/include/c++/3.4/string:47,
> > from ../base/devicebase.h:9,
> > from device.h:9,
> > from devicelan.h:9,
> > from devicelan.cpp:6:
> > /usr/include/c++/3.4/cstddef:52: error: `::ptrdiff_t' has not been
> declared
> > /usr/include/c++/3.4/cstddef:53: error: `::size_t' has not been declared
I can't be sure without seeing the code, but my guess is that it is
complaining that it can't find `::size_t' and `::ptrdiff_t' because
those types have been wrapped in std namespace, but you are including
the non-namespace aware string.h header. If this is the case and you
change all includes of the type
#include <string.h>
to
#include <cstring>
and add a line such as this
using namespace std;
to each C++ file, I think you'll be good to go. HTH.
--
Regards,
Travis Spencer
Portland, OR USA