在MFC中怎么使用STL中的stack MFC!!! 很急 最好有例子

解决方案 »

  1.   

    不是那个意思 我的意思是 MFC中使用stack 而不是在C++中使用的STL中的stack 
      

  2.   

    没人指导的话还得自己写一个stack
      

  3.   

    MFC中使用stack,和C++中使用stack没有区别啊。MFC不是一种语言,只是一个C++的类库,和STL没有冲突。
      

  4.   

    #include<stack>std::stack obj;
      

  5.   

    // First.h: interface for the CFirst class.
    //
    //////////////////////////////////////////////////////////////////////#if !defined(AFX_FIRST_H__5C3C3D46_F093_48C2_8900_C2C9833585B7__INCLUDED_)
    #define AFX_FIRST_H__5C3C3D46_F093_48C2_8900_C2C9833585B7__INCLUDED_#if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000
    #define FILENAME "FunctorFirst.txt"
    typedef struct FirstVTChar 
    {
    char           UnTerminalChar;
    char           TerminalChar;
    BOOL           state;              //求FirstVT集合中state代表终结符于非终结符的关系
    }FirstVTChar;
    class CFirst  
    {
    public:
    CFirst();
    virtual ~CFirst();
    CStdioFile      file;//文件对象
    int             ncount;//文件的行数
    int             ncountTeminalChar;
    CString         strError;
    CString         *pstrFileData;
    char            *pUnTerminalChar;
    std::stack< FirstVTChar > f;
    有错误的 FirstVTChar 是个结构体
      

  6.   

    error C2653: 'std' : is not a class or namespace name
    c:\documents and settings\administrator\桌面\funfirst\first.h(29) : error C2143: syntax error : missing ';' before '<'
    c:\documents and settings\administrator\桌面\funfirst\first.h(29) : error C2501: 'stack' : missing storage-class or type specifiers
    c:\documents and settings\administrator\桌面\funfirst\first.h(29) : error C2059: syntax error : '<'
    c:\documents and settings\administrator\桌面\funfirst\first.h(29) : error C2238: unexpected token(s) preceding ';'
    Error executing cl.exe.
      

  7.   

    你没包含头文件.
    #include<stack>
      

  8.   

    在first.h中加头文件#include <stack> 
    你参考下 是不是用法问题 msdn也有例子
    #include <iostream>
    #include <vector>
    #include <string>
    #include <stack>
    using namespace std;
    void main()
    {
    // Arrary<T> arrary(5,43);
    stack<int> a;
    a.push(100);
    a.push(200);
    a.pop();
    cout<<a.top()<<endl;
    }
      

  9.   

    定义头文件
    #include <stack> 
    然后
    std::stack < T > f; 
    即可