Subject: linking tk's winMain.o with libfl under cygnus: linker-error
From: [email-masked] (Joachim Faulhaber)

9 Aug 1998 09:34:12 -0700
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="------------64C8ADB7C42F2A01F329BB48"
To: [email-masked]

--------------64C8ADB7C42F2A01F329BB48
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hello again,

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.

Thanks to Mumit Khan (Mumit, thank you for your posting) I got the
information
needed to link everything together. 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
-----------------------------------------

where winMain.c and tkConsole.c are from the latest soucecode distrib of

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
above.

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
tkappinit.c
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

--------------64C8ADB7C42F2A01F329BB48
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
<TT>Hello again,</TT><TT></TT>

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

<P><TT>Thanks to Mumit Khan (Mumit, thank you for your posting) I got the
information</TT>
<BR><TT>needed to link everything together. But I couln't get rid of the
following</TT>
<BR><TT>linker error:</TT><TT></TT>

<P><TT>C:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\</TT>
<BR><TT>2.7-B19\../../../libfl.a(libmain.o)(.text+0x9):libmain.c:</TT>
<BR><TT>undefined reference to `yylex'</TT>
<BR><TT>make: *** [myWish] Error 1</TT><TT></TT>

<P><TT>I figured out, that the error is independend of my own sources,
by compiling</TT>
<BR><TT>the following minimal myWish program:</TT><TT></TT>

<P><TT>------------- makefile: -----------------</TT>
<BR><TT>tkConsole.o: tkConsole.c</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; gcc -c -I. tkConsole.c -o tkConsole.o</TT>
<BR><TT>winMain.o: winMain.c</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; gcc -c winMain.c -o winMain.o</TT><TT></TT>

<P><TT>myWish: winMain.o tkConsole.o</TT>
<BR><TT>&nbsp;&nbsp;&nbsp; gcc tkConsole.o winMain.o -o myWish -ltk80 -ltcl80
-lfl -lm -mwindows</TT>
<BR><TT>-----------------------------------------</TT><TT></TT>

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

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

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

<P><TT>Any help is much appreciated</TT><TT></TT>

<P><TT>-- Joachim Faulhaber</TT></HTML>

--------------64C8ADB7C42F2A01F329BB48--

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