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

Joachim Faulhaber
Sun Aug 9 04:58:00 GMT 1998

Hello again,

I am working on porting a c++ program from linux to windoze. The
interface is implemented via an extension of tk's wish. I'm using
b19.1 on win95 and tcl/tk8.0.

Thanks to Mumit Khan (Mumit, thank you for your posting) I got the
needed to link everything together. But I couln't get rid of the
linker error:

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

where winMain.c and tkConsole.c are from the latest soucecode distrib
tk8.0. This program yields a proper wish-shell on my windoze95,
when linked
without the -lfl flag. Adding -lfl results in the linkererror reported

Since I'm using flex and bison in my own application, I have to
use libfl,
so I'm unable to link my program :( Another observation is, that
the linker
works normal when I am linking with the a usual main() like in
from unix. Also yylex() works fine then, when used.

Does anybody know how to solve the problem?
- am I missing something trivial ;-/ ?
- would the egcs compiler have the same problem ?
- are there alternative ways to build my application
  (via: loadable extension - as suggested by Mumit Khan -
instad of
  extending wish) How would that work?

Any help is much appreciated

-- Joachim Faulhaber

More information about the Cygwin mailing list