2010-11-20 78 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