edit:**SOLVED** 'std' is not a class or namespace name ?????

ElDonAntonio

Senior member
Aug 4, 2001
967
0
0
I'm having trouble compiling stl code in Visual C++. I'm getting the error "'std' is not a class or namespace name"
Can you find the error in this piece of code?? I guess std is defined as a namespace in some .h somewhere, but I've tried about everyone I could think of (stdio, stddef, stdlib, etc) with no success.


#ifndef MYCLASS
#define MYCLASS

#include <list.h>
#include <stdlib.h>

using std::list;

class myclass
{

public:
myclass();
~myclass();
private:
std::list<object> mylist;
};

#endif
 

singh

Golden Member
Jul 5, 2001
1,449
0
0
Try:
#include <list> (and not <list.h>)

While we're on the topic, VC++ 6's STL sucks. Either download STLPORT or SGI STL.
 

ElDonAntonio

Senior member
Aug 4, 2001
967
0
0
I tried that, no more luck...I'm getting mad at this!! :s
thanks for the tip anyway, any more ideas? :)
 

singh

Golden Member
Jul 5, 2001
1,449
0
0
Don't know why it isn't working for you. Removing #include <list.h> and replacing with #include <list> compiles fine on my system.
 

ElDonAntonio

Senior member
Aug 4, 2001
967
0
0
Alright, I just downloaded SGI STL. Just to make sure I'm correctly setup, I copied all the files in a folder "stl" in VC++'s include folder. I then added the "stl" folder in VC++'s include directories (tools->Options->Directories) and put it at the top of the list.

Unfortunately, I still get that same error...:|