Following up on my own RFH, I am sharing this with you for Justin Case.
gcc/g++ v.3.0+ now enforces namespace scope. This was not the case in
earlier versions. In order to use the C++ Standard Library it is necesary
to either preface each standard library function call or type declaration
with "std::" or the following,
using namespace std;
The antiquated, deprecated method of including ".h" in the #include
library name causes g++ to revert to its previous behavior. However, some
of the Standard Libraries have no antiquated equilivalent. For example,
you can find a ostream.h include file, but not a string.h include file.
Fred
On Tue, 25 Jan 2005, Fred Ramsing wrote:
> Hello all,
>
> Formerly, I ran RedHat 9.0. I compiled C++ source code just fine with
> gcc.
>
> Now I'm using gcc on Fedora Core 2 and cygwin, and I'm having trouble
> compiling C++ code with references to the Standard Template Library. If I
> use the modern header references, i.e.
>
> #include <string>
> #include <vector>
>
> the code won't compile, because the include files for STL are not
> included. If I use the deprecated reference, i.e.
>
> #include <string.h>
>
> the code compiles, but gcc complains about deprecated or antiquated
> headers.
>
> Note that specifing the INCLUDE path in my shell environment, makefile, or
> gcc command line call has no effect. Hence, gcc knows where the
> deprecated headers are, so why can't it use the new headers? I find this
> behavior identical for both cygwin and FC2.
>
> Any help would be appreciated.
>
>
> Fred
>
>
> _______________________________________________
> RLUG mailing list
> [email protected]
> http://lists.rlug.org/mailman/listinfo/rlug
>
_______________________________________________
RLUG mailing list
[email protected]
http://lists.rlug.org/mailman/listinfo/rlug