大家给看看我的一个模版的错误,

fisher3014 2009-07-30 09:16:15
Error : #20: identifier "IO" is undefined
Queue.h line 89 IO.TRACE("f");

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 93 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 98 OS_EXIT_CRITICAL()

Error : #20: identifier "IO" is undefined
Queue.h line 136 IO.TRACE("空");

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 143 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 148 OS_EXIT_CRITICAL()

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 209 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 214 OS_EXIT_CRITICAL()

Error : #276: name followed by "::" must be a class or namespace name
Queue.h line 277 Convert::HexToAsc(Str,Value );

compiler : E:\project\LPC2368-07-28\LPC2368\SRC\IO.cpp: 0 warnings, 9 errors


Error : armcc Compile exit status = 2


Error : #20: identifier "IO" is undefined
Queue.h line 89 IO.TRACE("f");

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 93 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 98 OS_EXIT_CRITICAL()

Error : #20: identifier "IO" is undefined
Queue.h line 136 IO.TRACE("空");

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 143 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 148 OS_EXIT_CRITICAL()

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 209 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 214 OS_EXIT_CRITICAL()

Error : #276: name followed by "::" must be a class or namespace name
Queue.h line 277 Convert::HexToAsc(Str,Value );

Warning : #546-D: transfer of control bypasses initialization of:
CharBitMap.cpp line 335 switch(CharMatrixStyle)

variable "Xtemp" (declared at line 397)


variable "XtempBit" (declared at line 398)


Warning : #546-D: transfer of control bypasses initialization of:
CharBitMap.cpp line 543 switch(FontStand)

variable "err" (declared at line 548)


variable "temp" (declared at line 549)


compiler : E:\project\LPC2368-07-28\PTR\CharBitMap.cpp: 2 warnings, 9 errors


Error : armcc Compile exit status = 2


Error : #20: identifier "IO" is undefined
Queue.h line 89 IO.TRACE("f");

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 93 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 98 OS_EXIT_CRITICAL()

Error : #20: identifier "IO" is undefined
Queue.h line 136 IO.TRACE("空");

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 143 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 148 OS_EXIT_CRITICAL()

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 209 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 214 OS_EXIT_CRITICAL()

Error : #276: name followed by "::" must be a class or namespace name
Queue.h line 277 Convert::HexToAsc(Str,Value );

compiler : E:\project\LPC2368-07-28\PTR\codabar.cpp: 0 warnings, 9 errors


Error : armcc Compile exit status = 2


Error : #20: identifier "IO" is undefined
Queue.h line 89 IO.TRACE("f");

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 93 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 98 OS_EXIT_CRITICAL()

Error : #20: identifier "IO" is undefined
Queue.h line 136 IO.TRACE("空");

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 143 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 148 OS_EXIT_CRITICAL()

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 209 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 214 OS_EXIT_CRITICAL()

Error : #276: name followed by "::" must be a class or namespace name
Queue.h line 277 Convert::HexToAsc(Str,Value );

compiler : E:\project\LPC2368-07-28\PTR\Code93.cpp: 0 warnings, 9 errors


Error : armcc Compile exit status = 2


Error : #20: identifier "IO" is undefined
Queue.h line 89 IO.TRACE("f");

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 93 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 98 OS_EXIT_CRITICAL()

Error : #20: identifier "IO" is undefined
Queue.h line 136 IO.TRACE("空");

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 143 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 148 OS_EXIT_CRITICAL()

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 209 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 214 OS_EXIT_CRITICAL()

Error : #276: name followed by "::" must be a class or namespace name
Queue.h line 277 Convert::HexToAsc(Str,Value );

compiler : E:\project\LPC2368-07-28\PTR\CODE_39.cpp: 0 warnings, 9 errors


Error : armcc Compile exit status = 2


Error : #20: identifier "IO" is undefined
Queue.h line 89 IO.TRACE("f");

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 93 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 98 OS_EXIT_CRITICAL()

Error : #20: identifier "IO" is undefined
Queue.h line 136 IO.TRACE("空");

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 143 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 148 OS_EXIT_CRITICAL()

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 209 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 214 OS_EXIT_CRITICAL()

Error : #276: name followed by "::" must be a class or namespace name
Queue.h line 277 Convert::HexToAsc(Str,Value );

compiler : E:\project\LPC2368-07-28\PTR\CodeBar.cpp: 0 warnings, 9 errors


Error : armcc Compile exit status = 2


Error : #20: identifier "IO" is undefined
Queue.h line 89 IO.TRACE("f");

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 93 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 98 OS_EXIT_CRITICAL()

Error : #20: identifier "IO" is undefined
Queue.h line 136 IO.TRACE("空");

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 143 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 148 OS_EXIT_CRITICAL()

Error : #20: identifier "VICIntEnClr" is undefined
Queue.h line 209 OS_ENTER_CRITICAL()

Error : #20: identifier "VICIntEnable" is undefined
Queue.h line 214 OS_EXIT_CRITICAL()
...全文
616 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
taodm 2009-07-30
  • 打赏
  • 举报
回复
自己去把template消了,变成普通类,编译过了再模板化。
就别自己折腾自己了。
fisher3014 2009-07-30
  • 打赏
  • 举报
回复
上面是源码
fisher3014 2009-07-30
  • 打赏
  • 举报
回复
#ifndef __QUEUE_H
#define __QUEUE_H
#include "Myclass.h"
#include "include.h"


extern SystemIO IO;
extern ERROR_TYPE MyErr;
extern ERR SysErr;

typedef uchar DataType; //对列数据元素的类型
// maximum size of a queue list
#ifdef LPC2368
const int MaxQSize = 12288; //队列的大小
#endif
#ifdef LPC2134
// const int MaxQSize = 112288; //队列的大小
#define MaxQSize 8192
#endif
template <typename DataType>
class Queue
{
private:
//queue array and its parameters
int32 front;
int32 rear;
//volatile long count; //队列的头、尾、长度
DataType qlist[MaxQSize];
public:

int32 count;

// }param;
// constructor构造函数
Queue (void); // initialize integer data members

// queue modification operations //修改操作
void QInsert(DataType item); //插入队列
DataType QDelete(ERROR_TYPE* err=/*&MyErr*/SysErr.P_Err()/*&ERR::Err*/,uint32 Delay=0xffff); //从对列取出一个元素
void ClearQueue(void); //清空队列

// queue access
//DataType QFront(void) const;
DataType QFront(ERROR_TYPE* err=SysErr.P_Err(),uint16 Delay=0xffff) const;
// queue test methods 测试
int QLength(void) const; //获取队列中数据的个数
int QEmpty(void) const; //看一下队列是否为空
int QFull(void) const; //看一下队列是否满
Queue& operator<<(const char*Str);
Queue& operator<<(const uchar Value);
Queue& operator<<(const uint32 Value);
Queue& operator<<(const uchar*Str);
};
//extern Queue<uchar> ReceiveBuffer;


///////////////////////////////////////////////////////////////
//#include <iostream>
//#include <stdlib.h>
//using namespace std;
template <typename DataType>
// initialize queue front, rear, count
Queue<DataType>::Queue (void) : front(0), rear(0), count(0)
{
//构造函数已给出
// param.write_ptr=param.buffer;
// param.read_ptr=param.buffer;
// param.count=0;
front=rear=0;
count=0;

}
template <typename DataType>
void Queue<DataType>::QInsert(DataType item)//插入数据
{
if(count>=MaxQSize)
{
IO.TRACE("f");
return;
}
//满了
OS_ENTER_CRITICAL()
*(qlist+rear)=item;
count++;
rear=rear+1;
rear>=MaxQSize-1 ? rear=rear-(MaxQSize-1) :rear;
OS_EXIT_CRITICAL()
//


/*
if(rear==front) //满了
return;
*(qlist+rear)=item;
rear=rear+1;
rear>=MaxQSize ? rear-MaxQSize :rear;

*/
//qlist[rear]=item;
// rear=(rear+1)%MaxQSize;
// count++;

// if(param.count>=PT_BUFFER_SIZE) //full
// return;
// *(param.write_ptr++) = item;
// param.count++;
// if(param.write_ptr >= (param.buffer + PT_BUFFER_SIZE))
// {
// param.write_ptr = param.buffer;
// }
}
template <typename DataType>
DataType Queue<DataType>::QDelete(ERROR_TYPE* err,uint32 Delay) //取出数据
{
for(uint32 i=0;i<Delay;i++)
{
if(count>0)
{
break; //空
}
// IO.TRACE("=");
if(i==(Delay-1))
{
*err=BufferEmpty;
IO.TRACE("空");
return 0;
}
}
//IO.TRACE("count");
//IO.TRACE(count);
//IO.TRACE("\r\n");
OS_ENTER_CRITICAL()
DataType e = qlist[front];
count--;
front++;
front>=MaxQSize-1 ? front=front-(MaxQSize-1) :front;
OS_EXIT_CRITICAL()
*err=No_Err;
return e;

/* if(front==rear); //空了
return 0;
front++;
front>=MaxQSize ? front-MaxQSize :front;
if(front==rear); //空了
return 0;

//uchar temp;
// cout << "Queue is empty" << endl;
DataType e = qlist[front];
//front=(front+1)%MaxQSize;
// count--;
return e;
*/
// if(param.count==0)return(0);
//uchar temp=(*param.read_ptr++);
// param.count--;
// if(param.read_ptr >= (param.buffer + PT_BUFFER_SIZE))
// {
// param.read_ptr = param.buffer;
// }
// return(temp);

// return 0xa2;
}
template <typename DataType>
void Queue<DataType>::ClearQueue(void) //清除队列
{
front=rear=0;
count=0;
// param.write_ptr=param.buffer;
// param.read_ptr=param.buffer;
// param.count=0;
}
template <typename DataType>
DataType Queue<DataType>::QFront(ERROR_TYPE* err,uint16 Delay) const //查看对列头部数据
{
/*
if(front==rear);
// cout << "Queue is empty" << endl;
DataType e=qlist[front];
return e;
*/
for(uint16 i=0;i<Delay;i++)
{
if(count!=0)
{
break; //空
}
// IO.TRACE("空");
if(i==(Delay-1))
{
*err=BufferEmpty;
return 0;
}
}

OS_ENTER_CRITICAL()
DataType e = qlist[front];
// count--;
// front++;
// front>=MaxQSize-1 ? front=front-(MaxQSize-1) :front;
OS_EXIT_CRITICAL()
*err=No_Err;
return e;
}
template <typename DataType>
int Queue<DataType>::QEmpty(void) const //察看队列的长度 空1 非空0
{
//if(front==rear)
if(count>0)
return 0;
else
return 1;
}
template <typename DataType>
int Queue<DataType>::QLength(void) const //察看队列的长度
{
return count;
//return 0;
}
template <typename DataType>
int Queue<DataType>::QFull(void) const //察看队列是否满了
{
if(count == MaxQSize)
return 1;
else
return false;
}
template <typename DataType>
///////////////////////////////////////////////////////////////////
Queue<DataType>& Queue<DataType>::operator<<(const char*Str)
{
uint32 i=0;

while((*(Str + i)) !=0)
{
QInsert(*(Str + i));
i++;
}
return *this;
}
template <typename DataType>
Queue<DataType>& Queue<DataType>::operator<<(const uchar*Str)
{
uint32 i=0;

while((*(Str + i)) !=0)
{
QInsert(*(Str + i));
i++;
}
return *this;
}
template <typename DataType>
Queue<DataType>& Queue<DataType>::operator<<(const uchar Value)
{
QInsert(Value);
return *this;
}
template <typename DataType>
Queue<DataType>& Queue<DataType>::operator<<(const uint32 Value)
{
// QInsert(Value);
char Str[10];
Convert::HexToAsc(Str,Value );
*this<<Str;
return *this;
}
#endif
mengjfu 2009-07-30
  • 打赏
  • 举报
回复
都是一些寄存器,大概是环境配置错误吧
superbtl 2009-07-30
  • 打赏
  • 举报
回复
都是未定义啊 没有实例化就出现了 应该是头文件缺少 如果是实例化 那应该是没有模板的相应类型的定义
taodm 2009-07-30
  • 打赏
  • 举报
回复
呃,这跟模板完全不搭的。是你没有include必要的系统头文件吧。

64,687

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧