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

Steve McAndrewSmith steve@finagle.org
Tue Aug 3 11:16:00 GMT 1999

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.


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

... works great.  BUT ...

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

"objdump --syms libtkapp.a" reports:

  winMain.o:     file format pe-i386
  [  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.  


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

More information about the Cygwin mailing list