KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How do I compile the lex file with gcc without receiving the following warnings? lex.yy.c: In function `yy_init_buffer': lex.yy.c:1688: warning: implicit declaration of function `fileno' lex.l: In function `storeLexeme': lex.l:134: warning: implicit declaration of function `strdup' These are the libraries I included. %{ #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> %} The function yy_init_buffer is not in the file. The following is the function storeLexeme. int storeLexeme() { for (int i = 0; i < count; i++) { char *curr = *(symbolTable + i); if (strcmp(curr, yytext) == 0) { return i; } } char *lexeme = (char *)malloc(sizeof(char *)); lexeme = (char *)strdup(yytext); symbolTable[count] = lexeme; count++; return (count - 1); } How do I remove the warnings?
Tags (comma-separated)
Save Edits
Cancel