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: <4270C34C.7070708@dcs.warwick.ac.uk> Date: Thu, 28 Apr 2005 12:04:44 +0100 From: Russell Martin Reply-To: martin AT dcs DOT warwick DOT ac DOT uk Organization: University of Warwick User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) MIME-Version: 1.0 To: Al Slater CC: cygwin AT cygwin DOT com Subject: Re: g++ compilation header difficulties (where are they?) References: <426FB47A DOT 6040400 AT dcs DOT warwick DOT ac DOT uk> <426FDF60 DOT 3000109 AT scluk DOT com> In-Reply-To: <426FDF60.3000109@scluk.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Al Slater wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Russell Martin wrote: > >>program only results in a "No such file or directory" error. Using >>"find", I can only locate (for example) "stdlib.h" and there is no file >>"stdlib" anywhere. I do have a file "iostream" in the > > > I beleive the header you want is cstdlib. > Yes, that works. > >>euler.cpp: In function `int main(int, char**)': >>euler.cpp:21: error: `string' undeclared (first use this function) >>euler.cpp:21: error: (Each undeclared identifier is reported only once >>for each function it appears in.) >>euler.cpp:21: error: parse error before `;' token > > > string is in the std namespace so try std::string or add "using > namespace std;" near the top of your file. > Okay, that works too, and it takes care of the "deprecated" warnings too when I was using the header files 'iostream.h' and 'fstream.h' (instead of the more current and correct 'iostream' and 'fstream'). I hadn't realized that there are new ANSI C++ standards for specifying the inclusion of headers in your code (at least they are new to me!!). Since I don't program all that much, this was the first trouble I had when I encountered them. I will have to read up on these to avoid further difficulties in the future. Many thanks for your help! > >>----- >>Despite the fact that the header file "string" is located in the >>directory /usr/include/c++/3.3.3 the compiler seemingly can't locate >>it. This is puzzling since it lists this path in the #include >>search path above. Even placing the source code into the >>/usr/include/c++/3.3.3 directory and trying to compile it there gives >>the same error. What am I overlooking here, or not understanding? > > > Why do you think it was not found, the compiler did not output any error > messages indicating this. I was assuming that it wasn't found based on the error messages 'euler.cpp:21: error: `string' undeclared (first use this function) euler.cpp:21: error: (Each undeclared identifier is reported only once for each function it appears in.)' that I was getting. However, with the directive you gave me (the "using" above), everything seems to have cleared up. Once again, I must read up on the new standards and their proper usage. Thanks again! Russ > > - -- > Al Slater > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.0 (MingW32) > Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org > > iD8DBQFCb99gz4fTOFL/EDYRAqBbAKCFm/TbEZxzG46TOni5sy3uv2sFAACeJM/+ > 8wUow/N90NRJ93qOac9pB2M= > =5Bi8 > -----END PGP SIGNATURE----- > -- 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/