CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
花落谁家,你作主! 盛大widget设计大赛英雄榜
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  基础类

VC是否支持STL?

楼主x_xy(sunny)2002-05-21 13:07:43 在 VC/MFC / 基础类 提问

请问VC是否支持STL,我用的是VC6.0,想编译一个调用了STL中list容器的程序,结果出错,说是缺少一个存储类的指定?难道list<>中需要两个参数吗?结果看到CRT中的list倒是需要两个参数的,CRT和STL不是一回事吧?怎么才能让VC支持STL呢?  
  请指教! 问题点数:20、回复次数:11Top

1 楼linxiao()回复于 2002-05-21 13:10:45 得分 0

当然支持啊Top

2 楼linxiao()回复于 2002-05-21 13:11:59 得分 0

#include   <list>  
  #include   <iostream>  
   
  using   namespace   std   ;  
   
  typedef   list<int>   LISTINT;  
   
  void   main()  
  {  
          int   rgTest1[]   =   {5,6,7};  
          int   rgTest2[]   =   {10,11,12};  
   
          LISTINT   listInt;  
          LISTINT   listAnother;  
          LISTINT::iterator   i;  
   
          //   Insert   one   at   a   time  
          listInt.insert   (listInt.begin(),   2);  
          listInt.insert   (listInt.begin(),   1);  
          listInt.insert   (listInt.end(),   3);  
   
          //   1   2   3  
          for   (i   =   listInt.begin();   i   !=   listInt.end();   ++i)  
                  cout   <<   *i   <<   "   ";  
          cout   <<   endl;  
   
          //   Insert   3   fours  
          listInt.insert   (listInt.end(),   3,   4);  
   
          //   1   2   3   4   4   4  
          for   (i   =   listInt.begin();   i   !=   listInt.end();   ++i)  
                  cout   <<   *i   <<   "   ";  
          cout   <<   endl;  
   
          //   Insert   an   array   in   there  
          listInt.insert   (listInt.end(),   rgTest1,   rgTest1   +   3);  
   
          //   1   2   3   4   4   4   5   6   7  
          for   (i   =   listInt.begin();   i   !=   listInt.end();   ++i)  
                  cout   <<   *i   <<   "   ";  
          cout   <<   endl;  
   
          //   Insert   another   LISTINT  
          listAnother.insert   (listAnother.begin(),   rgTest2,   rgTest2+3);  
          listInt.insert   (listInt.end(),   listAnother.begin(),   listAnother.end());  
   
          //   1   2   3   4   4   4   5   6   7   10   11   12  
          for   (i   =   listInt.begin();   i   !=   listInt.end();   ++i)  
                  cout   <<   *i   <<   "   ";  
          cout   <<   endl;  
  }  
   
     
  Program   Output   is:  
   
  1   2   3  
  1   2   3   4   4   4  
  1   2   3   4   4   4   5   6   7  
  1   2   3   4   4   4   5   6   7   10   11   12  
   
  Top

3 楼aileen_long(期待2002)回复于 2002-05-21 13:12:27 得分 0

VC6不支持所有的STL元素,但list还是支持的。把你的代码和错误贴出来看看!Top

4 楼jeffchen(Jeff)回复于 2002-05-21 13:14:44 得分 0

支持,但在使用时需要指定名字空间,using   namespace   std或者std::XXXXXXXTop

5 楼tigerVC(Tiger.Z)回复于 2002-05-21 13:20:49 得分 0

如果代码没有问题,看一下你的编译设置有没有错。Top

6 楼x_xy(sunny)回复于 2002-05-21 13:32:09 得分 0

using   namespace   std竟然也不支持?  
   
  #include   <list>  
  using   namespace   std  
   
  class   Administrator      
  {  
  public:  
  Administrator();  
  。。。  
   
  结果说是:  
  error   C2143:   syntax   error   :   missing   ';'   before   '<class-head>'Top

7 楼x_xy(sunny)回复于 2002-05-21 13:33:03 得分 0

编译设置需要怎么改?Top

8 楼Q_O()回复于 2002-05-21 13:44:43 得分 0

检查一下再不是差个“}”Top

9 楼aileen_long(期待2002)回复于 2002-05-21 13:49:00 得分 20

using   namespace   std   //   编译器不是已经告诉你少了分号嘛Top

10 楼x_xy(sunny)回复于 2002-05-21 14:15:57 得分 0

呵呵,我真蠢,谢谢!Top

11 楼littlecatie(cool)回复于 2002-05-21 14:34:26 得分 0

STL是标准c++中的,VC当然支持Top

相关问题

  • VC是否支持STL?
  • VC不支持STL的fstream?
  • STL是否支持Unicode
  • VC++是这么支持STL的吗?
  • vc中是否支持int32_t类型?
  • VC与STL:VC编辑、编译环境对STL支持有问题?
  • VC对STL的支持也太差了,请看一个例子
  • vc编译器对stl的支持是不是不好?
  • stl在vc中是否派不上用场?
  • VC++.net编写的activex控件是否需要.netFramework支持

关键词

  • stl
  • vc
  • listint
  • insert
  • begin
  • list
  • using namespace

得分解答快速导航

  • 帖主:x_xy
  • aileen_long

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo