c - 包括因语法错误而崩溃的 .h 文件

标签 c

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

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;
}

最佳答案

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

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

关于c - 包括因语法错误而崩溃的 .h 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52456208/

相关文章:

C http 服务器向我的服务器发送获取请求?

C:用数字 0 到 n -1 索引 pthread

c - 向双向链表末尾插入一个元素

c - C 中的 While 循环在请求用户输入之前迭代两次

c - Unsigned int 未给出预期值

c - 尝试安装 valgrind 但卡在 make valgrind,怎么办?

c - 输入末尾的预期声明或语句 - 错误

c - c 位域的平台独立存储

c - 输入不同类型(在 C 中)

c - C 中 mmap 中的 EOF 和 PAGESIZE