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 Message-ID: <42B3AFAC.BAFC81A5@dessent.net> Date: Fri, 17 Jun 2005 22:22:52 -0700 From: Brian Dessent MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Perhaps a silly question or two References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Report: -5.8/5.0 ---- Start SpamAssassin results * -3.3 ALL_TRUSTED Did not pass through any untrusted hosts * -2.6 BAYES_00 BODY: Bayesian spam probability is 0 to 1% * [score: 0.0000] * 0.1 AWL AWL: From: address is in the auto white-list ---- End SpamAssassin results X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com "G.A.L." wrote: > (1) I've installed cygwin and am building using the C++ compiler - in order > to get code using the STL to build, do I have to install the Standard > Template Library in addition to the C++ compiler? I ask because it doesn't > appear that I can get my STL code calls to build. No. The library is included in the gcc-g++ package, which you presumably already have if you are trying to compile with g++. (On a related note, this is precisely why we ask that you provide the output of cygcheck in your problem report so that we don't have to guess about what you may or may not have installed.) You should post an actual example of what you are trying to compile, the exact command you are using to compile, and the result. We are not mind readers and cannot help without details. > (2) More of a compiler question - does my resulting C++ executable require > any run time libraries? I ask because I'd like to know what (if any) > libraries need to be installed on a target system. If you compile with Cygwin's gcc/g++ then your binary will depend on cygwin1.dll, and probably many other aspects of the Cygwin environment, depending on what functions you call. When I say "aspects of the Cygwin environment", this can mean many things: DLLs, regular files (such as /usr/share/zoneinfo/* or /etc/passwd), mounts, etc. One example is calling the system() call: this will require that /bin be mounted and that there be a sh.exe in that path, since system() calls "/bin/sh -c command". So if your program used this call, it would not be sufficient just to package yourbinary.exe and cygwin1.dll and give it to someone. For this reason it's usually better just to have the person install Cygwin if you want to distribute a cygwin binary. You've got to remember that Cygwin emulates a full unix/posix environment, and this often extends beyond just being a library. You can see what DLLs a binary depends on with the cygcheck command. Your binary must also be distributed under the terms of the GPL or another OSI approved license if it depends on cygwin1.dll. This is the price that you pay for taking advantage of the posix emulation layer that Cygwin provides. If you wish to write native windows binaries that have no dependency on cygwin1.dll nor any particular licensing restrictions, then you need to use mingw. If you go to www.mingw.org you can read about the project and download their binaries. Alternatively, since the "cygwin" and "mingw" flavors of gcc are so similar there is a shortcut that you can use to compile using the mingw environment under Cygwin. Install the appropriate gcc-mingw-* packages and use the -mno-cygwin flag when compiling. But you must always keep in mind that the mingw environment is not called "minimalist" for nothing. You are more or less limited to calling functions in the Win32 API or the Microsoft C runtime library (MSVCRT*.dll) that exists on all windows systems. If the code that you're building is is written to use unix/posix functions not part of the C standard library, you will either have to make it a Cygwin program (with the gotchas mentioned above), or rewrite it to use native win32 APIs. 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/