我是一名使用C89编译器的开发者,最近遇到了一些指针类型错误。
调用代码如下:
struct cpu_state_type cpu_state;
//Stuff here....
foo()
{
print_out_cpu(&cpu_state);
}
Print_out_cpu在其他地方被定义,而且H文件已经被包含进来了。
struct cpu_state_type
{
int r[12];
};
void print_out_cpu(struct cpu_state_type *c);
我遇到了错误:
error: ‘print_out_cpu’的第1个参数类型不兼容
据我所知,&cpu_state
返回的类型是cpu_state_type*
,所以我很困惑。
(cpu_state_type*)
然后看是否能正常运行或崩溃? - pajtonstruct cpu_state_type
的定义在哪里? - Bertrand Marronstruct cpu_state_type*
时,print_out_cpu
函数没有匹配项 - 这让我想到你在某个地方有冲突的声明。 - Nikolai Fetissov