RT,想在vc写的程序里加入自己的东西,但不能声明标准库内容,请各位指教,谢谢

解决方案 »

  1.   

    可以呀
    #include <vector>::std::vector< UINT >  VecInt;
    VecInt.push_back(2);
    VecInt.push_back(3);
      

  2.   

    #include "stdafx.h"
    #include <vector>
    using namespace std;
    在C++当中,所有的头文件被包含在名字空间中,为了跟C兼容,可以直接写#include<iostream.h>而不需用using namespace std; 但是,如果写法是这种格式的话:#include<iostream>,则需要用到using namespace std
      

  3.   

    #include<vector>
    #include<list>
    using namespace std;
      

  4.   

    同意 kingzai()
    说得很全面了。
      

  5.   

    你们说的头文件我都正确声明了,但我现在想在VC程序里读写文件,写下如下代码:
    ::std::ifstream infile("xxx.txt");
    但编译时出现如下错误,请各位指教,谢谢.error C2079: “infile”使用未定义的 class“std::basic_ifstream<_Elem,_Traits>”
            with
            [
                _Elem=char,
                _Traits=std::char_traits<char>
            ]
      

  6.   

    如果要使用ifstream or ofstream的话
      

  7.   

    应该是没有包含头文件<fstream>
      

  8.   

    #include "fstream"
    ::std::ifstream infile("xxx.txt");
    or
    #include "fstream"
    using namespace std;
    ifstream infile("xxx.txt");
      

  9.   

    error C2079: “infile”使用未定义的 class“std::basic_ifstream<_Elem,_Traits>”哦 你的VC是中文版的呀?? 好像不太好。。回答楼上的都说了 能搞定了把