File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 1+ /* src/runtime/object.c */
12#include <stdio.h>
23#include <stdlib.h>
34#include <string.h>
45
5- #include "memory.h"
6- #include "object.h"
7- #include "value.h"
8- #include "vm.h"
9- #include "chunk.h" // <--- ADD THIS (Needed for initChunk)
6+ #include "../include/memory.h"
7+ #include "../include/object.h"
8+ #include "../include/value.h"
9+ #include "../include/vm.h"
10+ #include "../include/chunk.h"
11+
12+ // This is the critical fix for the "vm undeclared" error:
13+ extern VM vm ;
1014
1115#define ALLOCATE_OBJ (type , objectType ) \
1216 (type *)allocateObject(sizeof(type), objectType)
1317
1418static Obj * allocateObject (size_t size , ObjType type ) {
1519 Obj * object = (Obj * )reallocate (NULL , 0 , size );
1620 object -> type = type ;
17- object -> next = vm .objects ;
21+ object -> next = vm .objects ; // Now works because 'vm' is declared extern above
1822 vm .objects = object ;
1923 return object ;
2024}
You can’t perform that action at this time.
0 commit comments