此错误是什么意思:“错误:'type_name' 之前的预期说明符限定符列表"?

2021-12-23 00:00:00 pointers c struct c++

我一直在研究 Cell 处理器,我正在尝试创建一个包含 spe_context_ptr_t 的结构体,该结构体将在线程中用于启动 spe 上下文,并且还将保存指向将从线程内传递给 spu 上下文的其他内容的指针(目前我正试图使其成为通用指针,但实际上它将是指向我定义的另一个结构的指针).当我尝试编译时,出现以下错误:

I've been working on the Cell processor and I'm trying to create a struct that will hold an spe_context_ptr_t, which will be used within the thread to launch an spe context and will also hold a pointer to something else that will be passed to the spu context from within the thread (currently I'm trying to just make it a generic pointer, but in actuality it will be a pointer to another structure I've defined). When I try and compile, I get the following error:

spu/../common.h:38: error: expected specifier-qualifier-list before 'spe_context_ptr_t'

// here is the offending line(s)

typedef struct _PTHREAD_BLOCK {
    spe_context_ptr_t * context; // Error happens here
    uintptr32_t  args; 
 } PTHREAD_BLOCK;

推荐答案

编译器不知道 spe_context_ptr_t 是一个类型.编译此代码时,请检查适当的 typedef 是否在范围内.您可能忘记包含适当的头文件.

The compiler doesn't know that spe_context_ptr_t is a type. Check that the appropriate typedef is in scope when this code is compiled. You may have forgotten to include the appropriate header file.

相关文章