首页 > 解决方案 > 包括因语法错误而分解的 .h 文件

问题描述

以下包含指令将抛出以下错误:

GCC Compiler) ===|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Length'|

我正在使用代码块。此文件有什么问题(改写:分号已删除)

typedef struct xxxListItem{
    void *data;
    struct xxxListItem *next
}XXXList;
#define XXX_RESULT int
#define XXX_OK 0
#define XXX_MEMORY_ERROR 1
#define XXX_OUT_OF_BOUNDS 2
/*Makros
Keine */

//Prototypen
XXX_RESULT xxx_List_Create(XXXList **pp_list);
XXX_RESULT xxx_List_Insert(XXXList **pp_list, void *p_data);
XXX_RESULT xxx_List_Delete(XXXList **pp_list,int index);
XXX_RESULT xxx_List_Length(XXXList *p_list); //this seems to be faulty!
void xxx_List_Show(XXXList *p_list);

这里主要

#include <stdio.h>
#include <stdlib.h>
#include "XXXList.h"
int main(){
printf("Hello world!\n");
return 0;
}

标签: c

解决方案


正如 Jonathan Leffler 所提到的,您缺少分号:

typedef struct xxxListItem{
    void *data;
    struct xxxListItem *next; // <--- right here!
}XXXList;

推荐阅读