• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

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

ElDonAntonio

Senior member
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
 
Try:
#include <list> (and not <list.h>)

While we're on the topic, VC++ 6's STL sucks. Either download STLPORT or SGI STL.
 
Don't know why it isn't working for you. Removing #include <list.h> and replacing with #include <list> compiles fine on my system.
 
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...:|
 
Back
Top