2016-03-25 125 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