From: Paul G. <pga...@at...> - 2002-06-11 00:34:13
|
Hi folks, Please forgive the blow-by-blow commentary. On 10 Jun 2002 at 10:22, Wu Yongwei wrote: > Do you know what you were talking about? Did you confirm what you said? Be > careful not to mislead other people and yourself. > > Cygwin does have regex.h, which is NOT usable when -mno-cygwin is used. > regex.h will include sys/types.h, but NOT vice versa. Libregex of Cygwin > depends on cygwin1.dll, which seems NOT what the original poster wanted. > > I have verified all three of my statements. PLEASE verify what you write > before sending a message. Ok, Wu...in a form more understandable... > > Regards, > > Wu Yongwei > > --- Original Message from Paul Garceau --- > > Point in fact, if you are using Cygwin, with -mno-cygwin, then regex.h > actually does not exist. So, to answer the original question, regex.h does not exist when Cygwin gcc with -mno-cygwin flag is set (default). Just because something is set to do something by "default" does not make it "true" or "necessarily accurate". This is one of those cases. Regex.h can exist within Mingw Iff (if and only if, as someone else has already noted) you wish to use the facilities provided online which include regex.h (you downloaded it from somewhere). Also, as someone else has noted, regex.h is not part of Mingw headers. If there are any questions about regex.h, then chances are very good when such questions do come up that someone is a) attempting to build a Cygwin app under Mingw b) using the -mno-cygwin switch under Cygwin or c) has source code that can not be built under Mingw without adding the regex.h header to the existing Mingw installation directories (specifically, <Mingw>\include). regex.h will be found if it has been added to <Mingw>\include, and sys\types.h will be invoked. Since there was no definition from the original poster, one way or another, as to whether the person was using Cygwin or not, there was no way to accurately answer the question. Bear in mind, many people still download Cygwin, launch stuff with the -mno-cygwin flag set and automatically assume they are building/using Mingw (they are, but only to a limited degree when compared against the Mingw distro available from SF.). The very first thing a person will do (especially the newbies, bless them) in such cases, when they have discovered that Cygwin folks are not supporting -mno-cygwin flag (except as they need to) or they have discovered that something is missing when the -mno-cygwin switch is being used (the newbie in question typically assumes it is a Mingw problem), decide it is a good idea to let us know or to ask the folks here questions like, "Where is regex.h?" without any sort of prelude (again, that is fine, newbies are learning and can't be expected to know the intricacies of the build environment they have decided to try.) Fact is, regex.h does exist within the Cygwin header collections. It does not exist within Mingw header collections. So, yes, regex.h exists and, no, it does not exist. Another example, if you want to use regex.h with -mno-cygwin flag you can by using the following command line at the Cygwin bash prompt: gcc yourregextst.c -mno-cygwin -I/usr/include Go ahead and verify it if you want to. (I can think of at least one or two cases where I might want to use regex.h under -mno-cygwin, and can itemize a number of reasons as to why that would be useful if such a question ever came up.) In this particular circumstance, I have a reason to show that, yes, regex.h does exist and can be used, even when the -mno-cygwin switch is invoked, under Cygwin. The same can be said for any of the cygwin #include <headers> that are normally not searched when -mno-cygwin switch is set. Summary: Case 1: As noted in an earlier reply to this thread, if you include regex.h in the source code and you are using Cygwin (specifically, without -mno-cygwin) then you will also include Cygwin sys/types.h. Case 2: If you are using Cygwin and you have added the -I/usr/include to the gcc command line (as noted above), the -mno-cygwin switch, and you have included regex.h (within your source code), then you will also include the Cygwin sys/types.h header. Case 3: If you are using Mingw, you can include regex.h. regex.h will not be found in the default set of installed Mingw header files. Case 4: If you have Cygwin installed and Mingw, then you can use the technique noted above (Case 2) to reference the Cygwin headers on your hard drive from your Mingw build environment which can include regex.h (not recommended). Paul G. |