HuoLanguage / huo

interpreted language written in C
MIT License
212 stars 21 forks source link

unknown type name 'huo_ast' compilation error #56

Open rwhitworth opened 7 years ago

rwhitworth commented 7 years ago

Trying to compile with gcc or clang on Debian jessie. Receiving the following error (and a similar error with clang). Seeing this on git commit 152af3bad73520f49257450800d9e07c4d9ed799.

cc -g3 -std=c11 -Werror -Wall -Wextra -pedantic -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -MD -MF .structures/huo_ast.mk -MP -MD -MF src/structures/huo_ast.o -MP -MD -MF .huo_ast.mk -MP  -c -o src/structures/huo_ast.o src/structures/huo_ast.c
In file included from src/structures/value.h:5:0,
                 from src/structures/huo_ast.h:7,
                 from src/structures/huo_ast.c:6:
src/structures/structures.h:20:5: error: unknown type name ‘huo_ast’
     huo_ast *ast;
     ^
src/structures/structures.h:29:9: error: unknown type name ‘huo_ast’
         huo_ast *ast;
         ^
<builtin>: recipe for target 'src/structures/huo_ast.o' failed
make: *** [src/structures/huo_ast.o] Error 1
snordgren commented 7 years ago

From what I can see this is the result of this ordering, because value.h makes use of the huo_ast type:

#include "value.h"
typedef struct huo_ast_t huo_ast;

I tried swapping the two lines and it worked.

typedef struct huo_ast_t huo_ast;
#include "value.h"
rwhitworth commented 7 years ago

This issue can be closed if #59 is merged to master.

Thanks @snordgren for getting me over this hurdle