"Peter Koch Larsen" <> wrote...
>
> "Danny Anderson" <> skrev i en meddelelse
> news
...
> > On Thu, 14 Aug 2003 22:56:19 -0400, Danny Anderson wrote:
> >
> > > Hola!
> > >
> > > I am working on a program where I am including a library that came
with
> my
> > > numerical methods textbook. The "util.h" simply includes a large
number
> > > of files. I had to change the util.h slightly to adjust path names
and
> > > also take into account I am working with a case-sensitive OS.
> > >
> > > My program is below. The sticky point is that adding (#include
> "util.h")
> > > seems to negate the (#include <string>) statement somehow. How can I
> get
> > > around this? For obvious size reasons, I don't include the util.h
> > > library, etc. I did include the compiler error messages below.
> > >
> > > As always, thanks!
> > > Danny
> > >
> > I nosed through the files that util.h includes. It turns out that
> (util.h)
> > includes (Nlib.h) which includes all of the following:
> >
> > * ------------------------------------------------------------------- */
> > /* Function prototypes: ANSI C library */
> > /* -------------------------------------------------------------------
*/
> >
> > #include <math.h>
> > #include <stdio.h>
> > #include <stdlib.h>
> > #include <string.h>
> > #include <time.h>
> > #include <float.h>
> > #include <ctype.h>
> >
> >
> > I am thinking that this is the cause of my problem. Can I safely rename
> > <string.h> to <cstring> and carry on?
>
> No - the proper rename is to <string>, not <cstring>.
Peter,
<string.h> and <string> are two different headers.
Danny,
You should probably get into a habit of _always_ use new headers:
<cmath>, <cstdio>, <cstdlib>, <cstring>, <ctime>, <cfloat>, <cctype>
in your case.
> And while it should be
> safe, you are probably going to correct a lot of code - replacing string
> with std::string. Sp far as I'm aware, there should not be any nasty
> surprises here, though.
Why does this feel like Deja Vu? Haven't we already discussed this
a couple months back?... Weird.
Anyway, Peter is correct, changing <string.h> to <cstring> will not
really do anything, most likely. If you have "using namespace std;"
in your C++ code, the names will be declared in the global namespace
just as well as if you included the original, C, headers (with .h).
Victor