2010-11-20 112 views
0

我有一个硬件类,它有一个指向TLB类对象的指针,并在构造函数中初始化它。但是,Codeblocks(GNU GCC)给了我错误 “proj3_hardware.h | 15 |错误:'TLB'没有命名类型' ”proj3_hardware.h | 15 | error:expected';'在'*'标记之前指向抛出对象类的指针“不命名类型”

我只是看不到代码中的错误。谢谢。

proj3_hardware.h

#include <iostream> 
#include "proj3_globals.h" 
#include "proj3_pagetable.h" 
#include "proj3_tlb.h" 

class Hardware{ 

public: 

    // Defines the hardware parts 
    int global_simulation_time; 
    TLB* tlb; 
    PageManagement* pagemm; 

    // Hardware constructor and methods 
    Hardware(int pageTableType, int replacementAlgo); 

    void execute(); 
    void diskaccess(); 

}; 

proj3_tlb.h

#include <iostream> 
#include "proj3_globals.h" 

// Assumes that the TLB is using LRU 

class TLBEntry{ 

    public: 

     char validEntry; 
     int VirtualAddress; 
     int PhysicalAddress; 
     long LastUsed; 
}; 

class TLB{ 

    private: 

     TLBEntry entries[HARDWARE_TLBSIZE]; 
     int* simulation_time; 

    public: 

     TLB(int* simulation_time); 

     void tlb_add(int virtualaddress, int physicaladdress); 
     int tlb_lookup(int virtualaddress); 
     void tlb_flush(); 

}; 

回答

0

编译我。

该错误必须在其他代码中;检查其他头文件:

  • 任何可疑#define小号
  • 缺少分号?
  • 错包括卫兵(这是我最好的猜测)
+0

你明白了......头球卫是问题所在。 – JaLooNz 2010-11-20 15:24:53