你(们)好
我正在尝试返回指向预定义结构列表中特定结构的指针。
如果我在同一个文件中有代码、它会起作用、但如果我将它们拆分、我会得到错误
说明资源路径位置类型
符号"第一个"用不兼容的类型重新声明
main.c
#include "main.h" test_t *active; int main(void){ active = first(); uint32_t value = active->number; // continued processing ... }
main.h
#include "test.h"
测试.c
#include "test.h" test_t list[2] = { {.number = 1}, {.number = 2}, }; test_t * first(void) { return &list[0]; }
test.h
#include <stdint.h> typedef struct { uint32_t number; } test_t; test_t * first(void);
我出了什么问题?