【发布时间】:2012-04-23 21:39:29
【问题描述】:
我有类似的东西:
struct list{
struct list **next, **prev;
}
全局声明:
struct list *threads = &((struct list){&threads, &threads});
void* vp_threads; /Error here: previous declaration of 'vp_threads' was here
vp_threads = threads; //Error here: conflicting types for vp_threads
我尝试的第二种方法:
void* vp_threads = threads; //Error: initializer element is not constant
我必须这样做,因为...(见下文!)
void some_func()
{
add_head(vp_threads, ...)
...
}
void add_head(void* x, ...)
{ ... }
(PS:没有main()或初始化函数,这是core.c文件的那种,实现了.h中的所有函数)
为什么这不起作用,我只是想让 void* 指向我的结构。这是怎么回事?
【问题讨论】: