Re: problems compiling under c++ 3.4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/6/05, MIGUEL GONZALEZ CASTANYOS <mgc@xxxxxx> 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


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux