X-Spam-Check-By: sourceware.org Message-ID: <43A0CDE0.18C37D15@dessent.net> Date: Wed, 14 Dec 2005 17:58:56 -0800 From: Brian Dessent MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: CygWin + gcc to build Windows application written in C. References: <004a01c600cd$6985cd30$0300a8c0 AT Piero> 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-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 Piero Silvestri wrote: > - I'm looking for some documentation about -mno-cygwin and -mwindows > options, which I can't find neither in the gcc on-line manual, nor in the > gcc man pages, nor in the CygWin manual. Where they come from? Using the > first makes the compiler complain about a missing crt2.o (?), the last seems > to be ignored. -mno-cygwin essentially turns gcc into the gcc provided by mingw.org. Read the docs/wiki/faq/etc at that site for more information. Note that when you use gcc -mno-cygwin your search paths will be modified so that no Cygwin libraries/headers will be found, instead the mingw ones will be searched (/usr/include/mingw, /usr/lib/mingw). Essentially this is just a shortcut for compiling with the mingw toolchain under Cygwin - do not get confused and think that this somehow lets you use Cygwin library functions in any shape or form. If you use mingw or -mno-cygwin, you are essentially programming directly at the win32 API and the MSVCRT, you have no unix emulation at all other than what is provided by the microsoft C library. -mwindows is a linker option that is short for "--subsystem windows", just as -mconsole is short for "--subsystem console". You can read more about ld options at . The actual meaning of this setting is documented by the Microsoft linker's /SUBSYSTEM option: . This switch probably does not mean what you think it means. It does not mean "make a windows binary." Nor does it mean "allow the application to have a GUI." All it does is tell the system not to allocate a console for the program when it's started. > - I have a mysterious linker error (undefined reference to __imp___iob); I > searched the web and found some hints about using MinGW under Cygwin, but > nothing clear or certain; above all, only questions but not answers... That probably means that you're trying to mix and match cygwin-compiled and mingw-compiled objects into a final .exe. That's not going to work. Cygwin and mingw use completely separate C runtime environments. They should be considered different platforms completely. You can't expect to link a Cygwin library into a mingw .exe for example. 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/