size_t is not a member of 'std'

Vadatajs

Diamond Member
Aug 28, 2001
3,475
0
0
I'm taking the object oriented aspect of c++ this semister and whenever I try to use the size_t data type it tells me it isn't a part of 'std.' I am following all of the instructions in the book, but I am stumped on this one. Does size_t even exist? I am using it in a bag class. I have included <cstdlib> at the beginning of the header file. I'm using VC++ 6.0 sp5 btw.

class bag
{
public:
//TYPEDEFS AND MEMBER CONSTANTS
typedef int value;
typedef std::size_t sizeType;
enum {CAPACITY = 200};
//Constructor
bag() {used = 0;}
//Modification Member functions
void Insert(const value& entry);
void InsertMany(const value& entry, value& amount);
bool EraseOne(const value& target);
void operator +=(const bag& addend);
//Constant Member fucnctions
sizeType size() const {return used;}
sizeType Count(const value& target) const;


private:
value aList[CAPACITY]; //Data for products
sizeType used; //how much is used

}

The only errors I get during compile deal with the size_t type.
 

Vadatajs

Diamond Member
Aug 28, 2001
3,475
0
0


<< #include <STDDEF.H>

*if you open it, you'll see that size_t is simply an unsigned integer.
>>



Thanks alot for trying, but it didn't work. It turns out in VC++ 6, you don't put the 'std::' in front of size_t. I removed them and it worked fine. I appreciate the help though.