This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Mingw/Link: Can't find "WinMain" in library.


I've been trying to port (from MSVC) a handly little library (tkapp)
which eases building Tcl/Tk Win32 apps.  It provides a WinMain function,
and imports an AppInit() and a string of Tcl application script, and
handles the messy init stuff.

However, when I try to link my little sample/test program against this
library, it's unable to find WinMain (specifically, "WinMain@16").  But,
if I link directly against the library objects, it works fine.

Example:

  gcc -mwindows -mno-cygwin -o sample sample.o winMain.o tkapp.o -ltcl80
-ltk80

... works great.  BUT ...

  ar -cr ./libtkapp.a winMain.o tkapp.o
  gcc -mwindows -L. -mno-cygwin -o sample sample.o -ltkapp -ltcl80
-ltk80
  ... and ...
  gcc -mwindows -mno-cygwin -o sample sample.o ./libtkapp.a -ltcl80
-ltk80
  
... both fail with the following message:
   
/CYGNUS/CYGWIN~1/H-I586~1/BIN/../lib/gcc-lib/i586-cygwin32/2.95/../../../../i586-cygwin32/
    lib/libmingw32.a(main.o): In function `main':
  /home/noer/src/b20/comp-tools/devo/winsup/mingw/main.c:89: undefined
reference to
    `WinMain@16'
  collect2: ld returned 1 exit status

"objdump --syms libtkapp.a" reports:

  ...
  winMain.o:     file format pe-i386
  SYMBOL TABLE:
  [  4](sec  1)(fl 0x00)(ty  20)(scl   2) (nx 1) 0x00000004 _WinMain@16
  AUX lnno 0 size 0x0 tagndx 0
  ...

so it would seem that the correct object is included in the library.

Gak!  Any ideas?  I'm stumped, here.  

-Steve

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]