+ -
当前位置:首页 → 问答吧 → 为什么我包含了一个自己的头文件就报错,居然说标准库里有错?

为什么我包含了一个自己的头文件就报错,居然说标准库里有错?

时间:2011-12-01

来源:互联网

d:\programfile\vc98\include\list.h(37) : error C2146: syntax error : missing ';' before identifier 'Length'
d:\programfile\vc98\include\list.h(37) : error C2501: 'DWORD' : missing storage-class or type specifiers
d:\programfile\vc98\include\list.h(37) : error C2501: 'Length' : missing storage-class or type specifiers
d:\programfile\vc98\include\list.h(53) : error C2146: syntax error : missing ';' before identifier 'GetPrevLink'
d:\programfile\vc98\include\list.h(53) : error C2433: 'WINAPI' : 'inline' not permitted on data declarations
d:\programfile\vc98\include\list.h(53) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.


我的头文件为
//Queue.h
#include <iostream>

#define QElemType char

typedef struct QNode{
QElemType data;
QNode *next;
}QNode,*QueuePtr;

class Queue{
QueuePtr front; //头指针
QueuePtr rear; //尾指针
int cout; //计数器
public:
Queue();
~Queue();
bool push(QElemType c);//从队尾插入
bool pop(QElemType &e);//从队头出列
};

Queue::Queue()
{
cout=0;
front=rear=new QNode;
front->next=NULL;
}

Queue::~Queue()
{
QueuePtr p=front,q;
while(p!=NULL){
q=p;
p=p->next;
delete q;
}

}

bool Queue::push(QElemType c)
{
QueuePtr p=NULL;
p=new QNode;
if (p==NULL) {
std::cout<<"error";
exit(1);
}

p->data=c;
p->next=NULL;
rear->next=p;
rear=p;
++cout;
return true;
}
bool Queue::pop(QElemType &e)
{
if(front==rear) return false;
QueuePtr p=front->next;
e=p->data;
front->next=p->next;
if (rear==p)
{
rear=front;
}
delete p;
--cout;
return true;
}

作者: shimachao   发布时间: 2011-12-01

是不是路径问题?

作者: chaoplusplus   发布时间: 2011-12-01

热门下载

更多