undefined reference to WinMain@16

hi everyone! i have a .c file that i can compile without any errors but when i wnat to run it with "dev" it says "undefined reference to WinMain@16" and doesn't make any .exe file.if i run it with borland c i get the "unresolved external '-main' reference".basically i realise that it says i don't have a main func,but i do.and by reading other posts about this error i found out that if i create a new console project and add this file to it it will work,but i can't do that beause the .c file belongs to a "flex lexical analyzer" and it specifally says u should runt it on it's own.can anyone help?
it specifally says u should runt it on it's own.
Which raises an important question: If you know that, why are you trying to do exactly that?
The file is meant to be compiled alongside other files that use the generated yylex() (or somesuch) function, such as the output from Yacc/Bison.
thanks for replyin but no,i think u can run flex.exe file with a .l input file and it gives u a .c file(which is the file i have problem with) then using command-line you are supposed to give a txt file as input to the exe file generated by the c file.
and it gives u a .c file
Correct. Then you are supposed to include that file into existing project and call yylex() function defined in that file.

http://flex.sourceforge.net/
lex generates a C source file named, "lex.yy.c", which defines the function yylex(). The file "lex.yy.c" can be compiled and linked to produce an executable


http://flex.sourceforge.net/manual/Generated-Scanner.html#Generated-Scanner
Whenever yylex() is called, it scans tokens from the global input file yyin (which defaults to stdin). It continues until it either reaches an end-of-file (at which point it returns the value 0) or one of its actions executes a return statement.
Topic archived. No new replies allowed.