我有类似的东西:
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* 指向我的结构。这有什么问题?