problems building "old" C++ code with g++ 3.2.2

LLeweLLyn Reese
Fri Jun 27 00:23:00 GMT 2003

"Christopher J. Tengi" <tengi@CS.Princeton.EDU> writes:

> Let me preface this by saying that I am not a C++ programmer.  My build
> environment is a Sun SPARC Ultra10 running Solaris 8 with GCC 3.2.2.
> I am trying to build a few of the CAIDA tools for monitoring network traffic.
> I am starting with their arts++ package, but I'm not getting very far.  The
> very first message I get can be resolved by the '-Wno-deprecated' flag, but
> the second one (ISO C++ forbids...) seems to start a cascade of errors from
> which the compiler cannot recover:
> In file included from /usr/local/include/c++/3.2.2/backward/ostream.h:31,
>                  from ../include/ArtsHeader.hh:53,
>                  from ../include/Arts.hh:49,
>                  from
> /usr/local/include/c++/3.2.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the
>  32 headers found in section of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the depreca
> ted header <strstream.h>. To disable this warning use -Wno-deprecated.
> In file included from ../include/ArtsAttributeVector.hh:48,
>                  from ../include/Arts.hh:50,
>                  from
> ../include/ArtsAttribute.hh:294: ISO C++ forbids declaration of `string' with 
>    no type
> ../include/ArtsAttribute.hh:294: parse error before `(' token
> ../include/ArtsAttribute.hh:368: ISO C++ forbids declaration of `string' with 
>    no type
> ../include/ArtsAttribute.hh:368: declaration of `const int 
>    ArtsAttribute::string'
> ../include/ArtsAttribute.hh:294: conflicts with previous declaration `const int 
>    ArtsAttribute::string'
> ../include/ArtsAttribute.hh:368: parse error before `(' token
> ../include/ArtsAttribute.hh:376: parse error before `&' token
> ../include/ArtsAttribute.hh:501: syntax error before `*' token

The ISO C++ standard requires that string be in the std namespace,
    requiring a 'using namespace std' using directive, or requiring
    string to be referred to as 'std::string'. It looks as if this
    code does not do that.

> Other than learning C++ and re-writing all of the code to be more
> compliant with the C++ standard, is there any way I can get the
> compiler to accept this code for what it is?

Install gcc 2.95.3 . Additionally, please contact the maintainers of
    CAIDA and inform them their code needs to updated.

It was intended that gcc 2.9x be the transition compiler - so it
    accepts both forms. Developers were / are expected to fix their
    code before moving to gcc 3.x . Unfortunately, it's been over 2
    years now, and too many still have not fixed their code.

> I have a Pentium
> system running the Red Hat 7.3 Linux distribution, which includes
> GCC 2.96, and that compiler is perfectly happy with the code.  I'd
> rather not "downgrade" the compiler on the Solaris system, but I
> wouldn't mind "upgrading" to GCC 3.3, if that will offer me a path
> to deal with this issue.

Sorry. If you like, you could raise the issue with the gcc developers,
    via gcc at (I'm just a fellow user.)

More information about the Gcc-help mailing list