Hello, I have a few source code files, such hashtable.c and such. The main issue is that when I write my main.c as such:
#include "tokens.h"
#include <stdio.h>
void yyerror(char *errorMsg)
{
fprintf(stderr, "%s\n", errorMsg);
}
main()
{
yyparse();
hsh = createHashtable();
}
And at the top of my yacc file (parser.y), I want to declear a hash table as such:
%{
#include <stdio.h>
#include "tokens.h"
#include "ast.c"
struct hashtable *hsh;
.............................
..............................
However I am getting this error.
main.c: In function ‘main’:
main.c:24: error: ‘hsh’ undeclared (first use in this function)
main.c:24: error: (Each undeclared identifier is reported only once
main.c:24: error: for each function it appears in.)
make: *** [main.o] Error 1
I am rather naive while it comes to C programming, any assistance will be greatful