私は次のようなものを持っています:
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
私が試した2番目の方法:
void* vp_threads = threads; //Error: initializer element is not constant
私はこれをしなければならないので...(以下を参照してください!)
void some_func()
{
add_head(vp_threads, ...)
...
}
void add_head(void* x, ...)
{ ... }
(追記: main() や初期化関数はありません。これは core.c ファイルのようなもので、.h にあるすべての関数を実装しています)
なぜこれがうまくいかないのか、void* を自分の構造を指すようにしようとしているだけです。これの何が問題なのですか?