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.
//
//////////////////////////////////////////////////////////////////////#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 是个结构体
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.
#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;
}
#include <stack>
然后
std::stack < T > f;
即可