#include
void main()
{
list< int > iList;
}
VC++ 6 simply states that list is an undeclared identifier even though it is defined in "list" (there is not suposed to be a .h).
Why won't STL work?
I don''t get it. What is wronge with this?
try this:
All header files in MSVC that do not end with a ".h" are encapsulated in namespace std so that they won't cause collisions with other libraries.
Also, be sure you have at least service pack 3 for MSVC 5.0 or 6.0--earlier releases had problems with templates, which causes major problems with STL.
Edited by - Stoffel on August 4, 2000 2:15:34 PM
#include <list>using namespace std;int main (){ list<int> iList; return 0;}
All header files in MSVC that do not end with a ".h" are encapsulated in namespace std so that they won't cause collisions with other libraries.
Also, be sure you have at least service pack 3 for MSVC 5.0 or 6.0--earlier releases had problems with templates, which causes major problems with STL.
Edited by - Stoffel on August 4, 2000 2:15:34 PM
VC++ does things kind of screwey. I *think* you need to use std::list var;
quote: Original post by Whirlwind
VC++ does things kind of screwey. I *think* you need to use std::list var;
Moron. This is Standard C++ behavior.
All STL classes are contained within the std namespace.
MSN
Knucklehead.
VC++ has bugs, so namespace doesn't work.
Edited by - Whirlwind on August 4, 2000 3:27:32 PM
quote:
Moron. This is Standard C++ behavior.
All STL classes are contained within the std namespace.
MSN
VC++ has bugs, so namespace doesn't work.
Edited by - Whirlwind on August 4, 2000 3:27:32 PM
quote:
VC++ has bugs, so namespace doesn''t work.
They work fine for me. Maybe you''re not using them correctly, or maybe you don''t have the latest service pack (though I don''t remember there being a namespace issue before).
quote:
VC++ has bugs, so namespace doesn''t work.
If namespaces don''t work, what was the std:: for?
The ''using namespace std'' bit. What else? The Queen Mary? You''re silly.
this...
...works perfectly in MSVC6 - no bugs to be found (although i have heard that the ms compiler has some trouble with nested namespaces, but ive never investigated that).
you should try to minimise use of the call: ''using namespace std;'', you should only bring what you want into the current scope by:
''using std::list;''
''using std::for_each;''
...
or just prefix all stl stuff with std:: and everything will be fine (albeit a bit more messy )
#include <list> void main(){ std::list<int> lst;}
...works perfectly in MSVC6 - no bugs to be found (although i have heard that the ms compiler has some trouble with nested namespaces, but ive never investigated that).
you should try to minimise use of the call: ''using namespace std;'', you should only bring what you want into the current scope by:
''using std::list;''
''using std::for_each;''
...
or just prefix all stl stuff with std:: and everything will be fine (albeit a bit more messy )
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement