Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lists.h
- #include "structs.h"
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- typedef struct list{
- Instr head;
- struct list *tail;
- } *ILIST;
- ILIST mkList(Instr, ILIST);```
- lists.c
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- ILIST mkList(Instr n, ILIST l1) {
- ILIST l = malloc(sizeof(struct list));
- l->head = n;
- l->tail = l1;
- return l;
- }
- structs.h
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- typedef enum {START, QUIT, ATRIB, ADD, SUB, MUL, PRINT, READ, IF, GOTO, LABEL} OpKind;
- typedef enum {INT_CONST, STRING, EMPTY} ElemKind;
- typedef struct{
- ElemKind kind;
- union
- {
- int val;
- char* name;
- }content;
- } Elem;
- structs.c
- #include "structs.h"
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- I get erros like this
- In file included from lists.h:1:0,
- from main.c:3:
- structs.h:5:16: error: redeclaration of enumerator ‘START’
- typedef enum {START, QUIT, ATRIB, ADD, SUB, MUL, PRINT, READ, IF, GOTO, LABEL} OpKind;
- ^~~~~
- In file included from main.c:1:0:
- structs.h:5:16: note: previous definition of ‘START’ was here
- typedef enum {START, QUIT, ATRIB, ADD, SUB, MUL, PRINT, READ, IF, GOTO, LABEL} OpKind;
- ^~~~~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement