Subject: help needed: linking wish and libfl with egcs or gcc under gnu-win32 fails
From: [email-masked] (Joachim Faulhaber)

14 Aug 1998 13:43:11 -0700
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="------------566A6E8B0792A14659598FFD"
To: [email-masked]

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

Hello,

I'm (still 8-|) working on the portation of a c++-program from Linux to
win32
whereby I use tk80 for the unserinterface and gnu-win32 b19.1 as
development
kit.

I'm unable to link my sources including a standard winMain.o from the
latest tk distribution. I sent a post about the problem to
[email-masked] and comp.lang.tcl last sunday, but I didn't get any

answers.

Since this portation is quite important to me and due to the fact that
this
task seems to be a standard case for many other projects I'm posting
this
topic again.

I'd be happy if anyone can give me any feedback about the problem.
I'd be even more happy if someone can give me clues what I can do about
it.

Since my last posting, I upgraded the compiler from gcc to egcs-1.0.2,
including binutils-980303 and lib++-2.8.0, as recommended by Mumit Khan.
But
the behavior is just the same as with gcc.

So I did a few "shooting in the dark"-experiments and tried to reduce
the
problem to it's essence which is:

--> A standard wish cannot be linked successfully with libfl under
gnu-win32:

objects to be linked                            result
-----------------------------------------------------------------------
winMain.o + tkConsole.o                     =>  a running wish, ok
winMain.o + tkConsole.o + libfl.a           =>  error:unresolved ref to
yylex
winMain.o + tkConsole.o + libfl.a + lexer.o =>  not launching wish

where lexer.c is a mini lexer-progam, generated by flex

I *very* much apprechiate any feedback or clue

Thanx in advance

- Joachim

-------- more details follow: ---------------------

Results were obtained using this makefile:
winMain.c and tkConsole.c are from tk8.0p2 sources
lexer.l is a little dummy-lexer wich is not called.
----------------------------- makefile -----------------------------
tkConsole.o: tkConsole.c
 gcc -c -I. tkConsole.c -o tkConsole.o
winMain.o: winMain.c
 gcc -c winMain.c -o winMain.o
lexer.o: lexer.c
 gcc -c lexer.c -o lexer.o

lexer: lexer.l
 flex -t lexer.l > lexer.c

myWish: winMain.o tkConsole.o
 gcc winMain.o tkConsole.o -o myWish \
            -mwindows -ltk80 -ltcl80

myWish1: winMain.o tkConsole.o
 gcc winMain.o tkConsole.o -o myWish1 \
            -mwindows -ltk80 -ltcl80 -lfl

myWish2: winMain.o tkConsole.o lexer.o
 gcc winMain.o tkConsole.o lexer.o -o myWish2 \
            -mwindows -ltk80 -ltcl80 -lfl
--------------------------------------------------------------------

make myWish:
   produces a remarkable number of warnings, but yields a running wish

gcc -c winMain.c -o winMain.o
In file included from
C:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.9
0.27\../../../../i386-cygwin32/include/windows.h:52,
                 from winMain.c:16:
C:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../../../i386-

cygwin32/include/Windows32/Structures.h:2434: warning: empty declaration

C:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../../../i386-

cygwin32/include/Windows32/Structures.h:2480: warning: empty declaration

C:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../../../i386-

cygwin32/include/Windows32/Structures.h:3411: warning: empty declaration

gcc -c -I. tkConsole.c -o tkConsole.o
In file included from tkPort.h:27,
                 from tkInt.h:26,
                 from tkConsole.c:16:
tkWinPort.h:119: warning: `struct timeval' declared inside parameter
list
tkWinPort.h:119: warning: its scope is only this definition or
declaration,
tkWinPort.h:119: warning: which is probably not what you want.
gcc winMain.o tkConsole.o -o myWish \
            -mwindows -ltk80 -ltcl80
/CYGNUS/B19/H-I386~1/i386-cygwin32/bin/ld.exe: warning: cannot find
entry symbo
l _WinMainCRTStartup; defaulting to 00401000

----------------------------------------------------------------------
make myWish1:
   produces the same warnings as myWish and the additional error:

C:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../../libfl.a

(libmain.o)(.text+0x9):libmain.c: undefined reference to `yylex'
make: *** [myWish1] Error 1

----------------------------------------------------------------------
make myWish2:
   warnings like myWish, but the linked program terminates immediately
   whithout launching wish

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

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

<P><TT>I'm (still 8-|) working on the portation of a c++-program from Linux
to win32</TT>
<BR><TT>whereby I use tk80 for the unserinterface and gnu-win32 b19.1 as
development</TT>
<BR><TT>kit.</TT><TT></TT>

<P><TT>I'm unable to link my sources including a standard winMain.o from
the</TT>
<BR><TT>latest tk distribution. I sent a post about the problem to</TT>
<BR><TT>[email-masked] and comp.lang.tcl last sunday, but I didn't
get any</TT>
<BR><TT>answers.</TT><TT></TT>

<P><TT>Since this portation is quite important to me and due to the fact
that this</TT>
<BR><TT>task seems to be a standard case for many other projects I'm posting
this</TT>
<BR><TT>topic again.</TT><TT></TT>

<P><TT>I'd be happy if anyone can give me any feedback about the problem.</TT>
<BR><TT>I'd be even more happy if someone can give me clues what I can
do about it.</TT><TT></TT>

<P><TT>Since my last posting, I upgraded the compiler from gcc to egcs-1.0.2,</TT>
<BR><TT>including binutils-980303 and lib++-2.8.0, as recommended by Mumit
Khan. But</TT>
<BR><TT>the behavior is just the same as with gcc.</TT><TT></TT>

<P><TT>So I did a few "shooting in the dark"-experiments and tried to reduce
the</TT>
<BR><TT>problem to it's essence which is:</TT><TT></TT>

<P><TT>--> A standard wish cannot be linked successfully with libfl under
gnu-win32:</TT>
<BR><TT></TT>&nbsp;<TT></TT>

<P><TT>objects to be linked&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
result</TT>
<BR><TT>-----------------------------------------------------------------------</TT>
<BR><TT>winMain.o + tkConsole.o&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=>&nbsp; a running wish, ok</TT>
<BR><TT>winMain.o + tkConsole.o + libfl.a&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
=>&nbsp; error:unresolved ref to yylex</TT>
<BR><TT>winMain.o + tkConsole.o + libfl.a + lexer.o =>&nbsp; not launching
wish</TT><TT></TT>

<P><TT>where lexer.c is a mini lexer-progam, generated by flex</TT><TT></TT>

<P><TT>I *very* much apprechiate any feedback or clue</TT><TT></TT>

<P><TT>Thanx in advance</TT><TT></TT>

<P><TT>- Joachim</TT>
<BR><TT></TT>&nbsp;<TT></TT>

<P><TT>-------- more details follow: ---------------------</TT><TT></TT>

<P><TT>Results were obtained using this makefile:</TT>
<BR><TT>winMain.c and tkConsole.c are from tk8.0p2 sources</TT>
<BR><TT>lexer.l is a little dummy-lexer wich is not called.</TT>
<BR><TT>----------------------------- makefile -----------------------------</TT>
<BR><TT>tkConsole.o: tkConsole.c</TT>
<BR><TT>&nbsp;gcc -c -I. tkConsole.c -o tkConsole.o</TT>
<BR><TT>winMain.o: winMain.c</TT>
<BR><TT>&nbsp;gcc -c winMain.c -o winMain.o</TT>
<BR><TT>lexer.o: lexer.c</TT>
<BR><TT>&nbsp;gcc -c lexer.c -o lexer.o</TT><TT></TT>

<P><TT>lexer: lexer.l</TT>
<BR><TT>&nbsp;flex -t lexer.l > lexer.c</TT><TT></TT>

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

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

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

<P><TT>make myWish:</TT>
<BR><TT>&nbsp;&nbsp; produces a remarkable number of warnings, but yields
a running wish</TT>
<BR><TT></TT>&nbsp;<TT></TT>

<P><TT>gcc -c winMain.c -o winMain.o</TT>
<BR><TT>In file included from C:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.9</TT>
<BR><TT>0.27\../../../../i386-cygwin32/include/windows.h:52,</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
from winMain.c:16:</TT>
<BR><TT>C:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../../../i386-</TT>
<BR><TT>cygwin32/include/Windows32/Structures.h:2434: warning: empty declaration</TT>
<BR><TT>C:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../../../i386-</TT>
<BR><TT>cygwin32/include/Windows32/Structures.h:2480: warning: empty declaration</TT>
<BR><TT>C:\CYGNUS\B19\H-I386~1\lib\gcc-lib\i386-cygwin32\egcs-2.90.27\../../../../i386-</TT>
<BR><TT>cygwin32/include/Windows32/Structures.h:3411: warning: empty declaration</TT>
<BR><TT>gcc -c -I. tkConsole.c -o tkConsole.o</TT>
<BR><TT>In file included from tkPort.h:27,</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
from tkInt.h:26,</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
from tkConsole.c:16:</TT>
<BR><TT>tkWinPort.h:119: warning: `struct timeval' declared inside parameter
list</TT>
<BR><TT>tkWinPort.h:119: warning: its scope is only this definition or
declaration,</TT>
<BR><TT>tkWinPort.h:119: warning: which is probably not what you want.</TT>
<BR><TT>gcc winMain.o tkConsole.o -o myWish \</TT>
<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-mwindows -ltk80 -ltcl80</TT>
<BR><TT>/CYGNUS/B19/H-I386~1/i386-cygwin32/bin/ld.exe: warning: cannot
find entry symbo</TT>
<BR><TT>l _WinMainCRTStartup; defaulting to 00401000</TT><TT></TT>

<P><TT>----------------------------------------------------------------------</TT>
<BR><TT>make myWish1:</TT>
<BR><TT>&nbsp;&nbsp; produces the same warnings as myWish and the additional
error:</TT><TT></TT>

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

<P><TT>----------------------------------------------------------------------</TT>
<BR><TT>make myWish2:</TT>
<BR><TT>&nbsp;&nbsp; warnings like myWish, but the linked program terminates
immediately</TT>
<BR><TT>&nbsp;&nbsp; whithout launching wish</TT>
<BR><TT></TT>&nbsp;</HTML>

--------------566A6E8B0792A14659598FFD--

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