Assembled from comments (because it was easier than finding a dupe):
-
In modern C (that is, C from this century), all functions need a return type and the only two legal prototypes for
mainare:int main(void) int main(int argc, char* argv[])An obsolescent way to write the first is
int main(). -
On Max OS, the flex distro doesn’t include
libfl.a. It comes withlibl.a. So use-llinstead of-lfl. But much better is to avoid the problem by telling flex not to requireyywrapby putting the following declaration in your prologue:%option noyywrapEven better is to use the following:
%option noinput nounput noyywrap nodefaultnoinputandnounputwill avoid “unused function” warnings when you compile with warnings enabled (which you should always do).nodefaulttells flex to not insert a default action, and to produce a warning if one would be necessary. The default action is to echo the unmatched character on stdout, which is usually undesirable and often confusing.
7
solved C error with Flex: type specifier missing?