2016-03-25 122 views
0

我一直在試圖解決這一問題的錯誤幾個小時,但有我丟失的東西:我有一個結構聲明爲類類型的錯誤C++與結構

typedef struct { 
    bool active; 
    unsigned long bbcount; 
    char buffer[BUFFSIZE]; 
    std::set<__uint> *bblist; 
} per_thread_t; 

後來我中號分配它的內存和設置一些變量,包括set這樣的:

per_thread_t *data = (per_thread_t *)malloc(sizeof(per_thread_t)); 
data->active = false; 
data->bblist = new std::set<__uint>(); 
data->bblist.find(6328); 

但我得到的錯誤error C2228: left of '.find' must have class/struct/union

我在這裏做錯了什麼?

謝謝

+0

' - >'爲指針。您需要取消引用指針。所以你可以去'(* data-> bblist).find'或'data-> bblist-> find'。 – Freddy

回答

4

bblist爲指針類型。您需要像這樣訪問它:

data->bblist->find(6328); 
+0

謝謝!我瘋了。我會在12分鐘內將其標記爲解決 – user1618465