linking tk's winMain.o with libfl under cygnus: linker-error

Joachim Faulhaber
Thu Sep 24 19:59:00 GMT 1998


a few weeks ago, I posted this problem. Meanwhile I found a workaround
for it.

>  I am working on porting a c++ program from linux to windoze. The user
> interface is implemented via an extension of tk's wish. I'm using
> Cygnus
> b19.1 on win95 and tcl/tk8.0.
> ... but I couln't get rid of the following
> linker error:
> C:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\
> 2.7-B19\../../../libfl.a(libmain.o)(.text+0x9):libmain.c:
> undefined reference to `yylex'
> make: *** [myWish] Error 1
> I figured out, that the error is independend of my own sources, by
> compiling
> the following minimal myWish program:
> ------------- makefile: -----------------
> tkConsole.o: tkConsole.c
>     gcc -c -I. tkConsole.c -o tkConsole.o
> winMain.o: winMain.c
>     gcc -c winMain.c -o winMain.o
> myWish: winMain.o tkConsole.o
>     gcc tkConsole.o winMain.o -o myWish -ltk80 -ltcl80 -lfl -lm
> -mwindows
> -----------------------------------------

The problem seems to be the flex-lib libfl, which somehow does't work
correctly with windows. Some flexpert should look at it. But there's a

Libfl doesn't do very much. It just provides a default yywrap function,
which isn't needed in most cases.

If you don't need to scan multiple files, use the %option noyywrap. If
you need the yywrap function you can define your own. In both cases you
can link your programs without libfl, and the linker-error disappears :)


Joachim Faulhaber

For help on using this list (especially unsubscribing), send a message to
"" with one line of text: "help".

More information about the Cygwin mailing list