This is the mail archive of the
cygwin
mailing list for the Cygwin project.
[OT] RE: g++ include string.h
- From: "Dave Korn" <dk at artimi dot com>
- To: <cygwin at cygwin dot com>
- Date: Mon, 17 May 2004 19:32:36 +0100
- Subject: [OT] RE: g++ include string.h
> -----Original Message-----
> From: cygwin-owner On Behalf Of Christian Rudiger
> Sent: 17 May 2004 19:00
> Hi there,
>
> i'm kind of newbee to c++ programming and try to do my first
> steps with
> the gcc in delivered with cygwin.
>
> I'd like to include the string.h into my little program but it wasn't
> found as the compiler doesn't accept my string declarations.
#1: string.h has nothing to do with the c++ string class. string.h is the
old c-style functions, string (no extension) contains the C++ string class.
#2: If a header file wasn't found, the compiler would issue an error or
warning, not just silently ignore it.
#3: All the standard C++ classes live in a namespace called 'std', so you
want to refer to them either as "std::string" or have a "using namespace
std;" statement at the top of your file.
#4: None of this is remotely cygwin-specific; you want to read a basic
tutorial on C++/stl programming. There are problems with the rest of your
code as you'll see once you've added the namespace line, but it's all
completely generic c++ stuff and this won't be the right place to bring them
up.
cheers,
DaveK
--
Can't think of a witty .sigline today....
--
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/