help needed: linking wish and libfl with egcs or gcc under gnu-win32 fails

Joachim Faulhaber jofa@berlin.snafu.de
Fri Aug 14 01:39:00 GMT 1998


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
gnu-win32@cygnus.com 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
 



More information about the Cygwin mailing list