为什么我包含了一个自己的头文件就报错,居然说标准库里有错?
时间: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;
}
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
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28