Undefined Reference to WinMain

Mumit Khan khan@xraylith.wisc.EDU
Thu May 13 15:03:00 GMT 1999


"Robert Campbell" <rob@geonexuscorp.com> writes:
> When compiling up the "V" appgen code, I get the following undefined
> references.  Does anybody have any ideas. (I'm using egcs-1.1.1)
> 
> /cygnus/CYGWIN~1/H-I586~1/i586-cygwin32/bin/ld: warning: cannot find entry
> symbol _WinMainCRTStartup; defaulting to 00401000
> 
> C:\cygnus\CYGWIN~1\H-I586~1\bin/../lib/gcc-lib/i586-cygwin32/egcs-.91.60/../
> ../../../i586-cygwin32/lib/libcygwin.a(libcmain.o): In function `main':
> /home/noer/src/b20/comp-tools/devo/winsup/libcmain.cc:38:
>     undefined reference to  `WinMain@16'
> 

Known problem. When linking GUI mode programs, the linker doesn't
explicitly look for WinMain, and if WinMain happens to be in an archive
(as in the case with V GUI), you lose.

Workaround: add "-Wl,-u,_WinMain@16" (without the quotes) to GCC flags when 
you link. For more discussion, see the thread titled 'VGUI v 1.21 problem' 
in the Cygwin mailing list archives.

Regards,
Mumit


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



More information about the Cygwin mailing list