`size_t' undeclared in namespace `std'

Albert Cervera Areny albertca@jazzfree.com
Wed May 14 23:26:00 GMT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,
I have developed an small proxy (proxirc.sourceforge.net) but I was developing 
it using gcc 2.9x
Now I've tried compiling it with 3.x and I can't. At first, somebody told me I 
had to add the 'using namespace std' or 'using std::string' to solve my 
problem and It was fixed, but now I get this one:

g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" 
- -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"proxirc\" 
- -DVERSION=\"0.5\"  -I. -I. -I libmsn -I /usr/include/g++-3   -O3 -g -O2 -c -o 
proxirc-proxirc.o `test -f 'proxirc.cc' || echo './'`proxirc.cc
In file included from /usr/include/c++/3.2/backward/new.h:33,
                 from /usr/include/g++-3/stl_algobase.h:52,
                 from /usr/include/g++-3/vector:30,
                 from libmsn/libmsn.h:27,
                 from proxirc.cc:23:
/usr/include/c++/3.2/backward/backward_warning.h:32:2: warning: #warning This 
file includes at least one deprecated or antiquated header. Please consider 
using one of the 32 headers found in section 17.4.1.2 of the C++ standard. 
Examples include substituting the <X> header for the <X.h> header for C++ 
includes, or <sstream> instead of the deprecated header <strstream.h>. To 
disable this warning use -Wno-deprecated.
In file included from /usr/include/c++/3.2/backward/new.h:34,
                 from /usr/include/g++-3/stl_algobase.h:52,
                 from /usr/include/g++-3/vector:30,
                 from libmsn/libmsn.h:27,
                 from proxirc.cc:23:
/usr/include/c++/3.2/new:79: `size_t' undeclared in namespace `std'
/usr/include/c++/3.2/new:79: declaration of `operator new' as non-function
/usr/include/c++/3.2/new:79: invalid declarator

I'm sorry if the answer is very simple (which I suspect it is) but I have not 
been able to find it in google nor in the archives.. Could somebody point me 
the possible causes or any document explaining the changes between 2.9x and 
3.x versions?

As a test I tried to compile this and it worked without problems. (Just to see 
if I needed <string> or <string.h>)

#include <stdlib.h>
#include <stdio.h>
#include <string>

using namespace std;

int main()
{
        string h;
        h="hola manola";
}

Thanks in advance!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE+wsfjTK7ZP4pDOHcRAmi6AKCDQVkAV8iRj0tD9oGe3Ugc9rEbawCfYM58
LXycg8f10wZ0vQp210ft5pE=
=0soM
-----END PGP SIGNATURE-----



More information about the Gcc-bugs mailing list