首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

error:ISO forbids declaration of 'vector' with no type解决方案

2012-06-27 
error:ISO forbids declaration of vector with no type编译的时候遇到这个问题,大家帮忙看看是怎么回事

error:ISO forbids declaration of 'vector' with no type
编译的时候遇到这个问题,大家帮忙看看是怎么回事啊

代码中先定义了一个CWorkerThread类,接着定义一个CThreadPool类,类中定义了两个vector<CWorkerThread*> m_BusyList; vector<CWorkerThread*> m_IdleList;编译的时候就出现了以上的问题

class CWorkerThread
{};

class CThreadPool
{
private:
  unsigned int m_InitNum; //Normal thread num;

protected:
  CWorkerThread* GetIdleThread(void);
  void AppendToIdleList(CWorkerThread* jobthread);
  void MoveToBusyList(CWorkerThread* idlethread);
  void MoveToIdleList(CWorkerThread* busythread);

public:
  CThreadMutex m_BusyMutex;  
  CThreadMutex m_IdleMutex;  
  CThreadMutex m_JobMutex; 

  CCondition m_BusyCond; //m_BusyCond is used to sync busy thread list
  CCondition m_IdleCond; //m_IdleCond is used to sync idle thread list
  CCondition m_IdleJobCond; //m_JobCond is used to sync job list

  vector<CWorkerThread*> m_BusyList; ///////问题出在这两行
  vector<CWorkerThread*> m_IdleList; //
  vector<CWorkerThread*>::iterator ite;

  CThreadPool();
  CThreadPool(int initnum);
  virtual ~CThreadPool(){}
  void SetInitNum(int initnum){m_InitNum = initnum;}
  int GetInitNum(void){return m_InitNum;}
  void Run(CJob* job);
};


[解决办法]
看着没啥问题。

热点排行