This is the mail archive of the cygwin 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]
Other format: [Raw text]

Re: [perl] Portably linking to libstdc++


Sisyphus wrote:

> Of course, the other option on both linux and cygwin is to set *both*
> $Config{cc} and $Config{ld} to 'g++', and that works fine on linux, but
> doesn't quite work on cygwin where I still get an undefined reference to
> `_WinMain@16':
> 
> /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../libcygwin.a(libcmain.o):(.text+0xab):
> undefined reference to `_WinMain@16'
> collect2: ld returned 1 exit status
> 
> Why does that happen ?

The error means you tried to link an executable that didn't contain a
main() function.  The fact that it refers to a missing WinMain() is
incidental, a byproduct of some compatibility code in Cygwin that
provides a backup main() which calls WinMain(), allowing the
Windows-style tradition where the user provides a WinMain() instead of
main().  Regardless of how it's spelled, you can't link an executable
without a proper entrypoint which is all the error means.

Please post the entire link command and not just the error.  It's
impossible to say what the true nature of the problem is otherwise.  For
example, if you're trying to link a library and not an executable then
the above error would be due to missing the "-shared" flag.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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