X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Message-ID: <48FC5562.1DDA1FAE@dessent.net> Date: Mon, 20 Oct 2008 02:54:42 -0700 From: Brian Dessent X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: [perl] Portably linking to libstdc++ References: <586E6C4720134D06B35A67112D3BBBCE AT desktop2> <48FB462B DOT 4B75336B AT dessent DOT net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 AT 16': > > /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../libcygwin.a(libcmain.o):(.text+0xab): > undefined reference to `_WinMain AT 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/