c++ code not compiling in RH9

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mike

    c++ code not compiling in RH9

    Hi

    I wrote some code ages ago when I was not very hot on c++ but it
    worked just fine. I had no problems compiling it on redhat 7.3 but
    that box died recently so I tried compiling the code on my new RH 9
    box and got the following error

    In file included from /usr/include/c++/3.2.2/cstdlib:52,
    from /usr/include/c++/3.2.2/bits/stl_algobase.h: 67,
    from /usr/include/c++/3.2.2/memory:54,
    from /usr/include/c++/3.2.2/string:48,
    from /usr/include/c++/3.2.2/bits/localefwd.h:49,
    from /usr/include/c++/3.2.2/ios:48,
    from /usr/include/c++/3.2.2/ostream:45,
    from /usr/include/c++/3.2.2/iostream:45,
    from lapackcmplx.h:8 ,
    from tmatrix.cpp:2:
    /usr/include/stdlib.h:742: parse error before `int'
    In file included from /usr/include/c++/3.2.2/bits/stl_algobase.h: 67,
    from /usr/include/c++/3.2.2/memory:54,
    from /usr/include/c++/3.2.2/string:48,
    from /usr/include/c++/3.2.2/bits/localefwd.h:49,
    from /usr/include/c++/3.2.2/ios:48,
    from /usr/include/c++/3.2.2/ostream:45,
    from /usr/include/c++/3.2.2/iostream:45,
    from lapackcmplx.h:8 ,
    from tmatrix.cpp:2:
    /usr/include/c++/3.2.2/cstdlib:90: `abs' not declared

    can anyone shed any light on this?

    Thanks
    Mike
  • Gianni Mariani

    #2
    Re: c++ code not compiling in RH9

    mike wrote:
    [color=blue]
    > /usr/include/c++/3.2.2/cstdlib:90: `abs' not declared
    >
    > can anyone shed any light on this?[/color]


    I think "abs" is not declared.



    Comment

    • mike

      #3
      Re: c++ code not compiling in RH9

      Gianni Mariani <gi2nospam@mari ani.ws> wrote in message[color=blue]
      >[color=green]
      > > /usr/include/c++/3.2.2/cstdlib:90: `abs' not declared
      > >
      > > can anyone shed any light on this?[/color]
      >
      >
      > I think "abs" is not declared.[/color]

      That much is clear - what I am wondering is why was it declared when I
      compiled it under RH 7.3 but it is not under RH 9.

      Comment

      • Gavin Deane

        #4
        Re: c++ code not compiling in RH9

        mike_uk31415@ya hoo.co.uk (mike) wrote in message news:<8ccca585. 0310020137.7e63 dff0@posting.go ogle.com>...[color=blue]
        > Gianni Mariani <gi2nospam@mari ani.ws> wrote in message[color=green]
        > >[color=darkred]
        > > > /usr/include/c++/3.2.2/cstdlib:90: `abs' not declared
        > > >
        > > > can anyone shed any light on this?[/color]
        > >
        > >
        > > I think "abs" is not declared.[/color]
        >
        > That much is clear - what I am wondering is why was it declared when I
        > compiled it under RH 7.3 but it is not under RH 9.[/color]

        So am I. But without seeing the code I would be guessing. I can get
        the error Gianni singled out with this:

        int main()
        {
        abs(42);
        return 0;
        }

        But I suspect your problem is more complicated.

        GJD

        Comment

        • Kevin Goodsell

          #5
          Re: c++ code not compiling in RH9

          mike wrote:
          [color=blue]
          > Gianni Mariani <gi2nospam@mari ani.ws> wrote in message
          >[color=green][color=darkred]
          >>>/usr/include/c++/3.2.2/cstdlib:90: `abs' not declared
          >>>
          >>>can anyone shed any light on this?[/color]
          >>
          >>
          >>I think "abs" is not declared.[/color]
          >
          >
          > That much is clear - what I am wondering is why was it declared when I
          > compiled it under RH 7.3 but it is not under RH 9.[/color]

          My guess would be that RH 9 comes with a much more up to date version of
          the compiler (7, IIRC, didn't even come with a "real" gcc - it was an
          unofficial version that wasn't supposed to be released).

          Chances are, if this version of gcc says there's an error it the code,
          there's an error in the code, and the old version was wrong to accept it.

          I suspect the problem may be that you are using abs() rather than
          std::abs(), and you don't have an appropriate 'using' declaration.

          -Kevin
          --
          My email address is valid, but changes periodically.
          To contact me please use the address from a recent posting.

          Comment

          Working...