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]

Re: Undefined Reference to WinMain


"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


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