MinGW not so good with exceptions?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave the Funkatron

    #1

    MinGW not so good with exceptions?

    Hey all,

    I'm using MinGW as part of my toolchain in Eclipse, and I am trying to
    figure out why I am getting a compiler error when I include the
    <limitsheader .

    The command that eclipse is running is

    g++ -IC:\Dave\School \common\cxx -IC:\Dave\School \common\third party
    \packages\glut-3.7.6-bin\include -IC:\Dave\School \common\third party
    \packages\pthre ads-2005-03-08\Pre-built\include -O0 -g3 -Wall -c -
    fmessage-length=0 -ogllib\test_gll ib.o ..\gllib\test_g llib.cpp



    The error I get is:

    In file included from C:/Dave/School/common/cxx/math/math_utils.h:13 ,
    from C:/Dave/School/common/cxx/gfx2d/color.h:9,
    from C:/Dave/School/common/cxx/gllib/gl_light.h:
    6, from ..\gllib\test_g llib.cpp:8:C:/mingw/bin/../lib/
    gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/limits:290: error:
    expected `;' before "throw"
    C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/
    limits:292: error: expected `;' before "static"
    C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/
    limits:292:22: macro "max" requires 2 arguments, but only 1 given



    If I go and look at that code in MinGW's "limits" file, I see the
    following struct, in which the the static min() function is the first
    offending line of code:

    template<typena me _Tp>
    struct numeric_limits : public __numeric_limit s_base
    {
    /** The minimum finite value, or for floating types with
    denormalization , the minimum positive normalized value. */
    static _Tp min() throw() { return static_cast<_Tp >(0); }
    /** The maximum finite value. */
    static _Tp max() throw() { return static_cast<_Tp >(0); }
    /** The @e machine @e epsilon: the difference between 1 and the
    least
    value greater than 1 that is representable. */
    static _Tp epsilon() throw() { return static_cast<_Tp >(0); }
    /** The maximum rounding error measurement (see LIA-1). */
    static _Tp round_error() throw() { return static_cast<_Tp >(0); }
    /** The representation of positive infinity, if @c
    has_infinity. */
    static _Tp infinity() throw() { return static_cast<_Tp >(0); }
    /** The representation of a quiet "Not a Number," if @c
    has_quiet_NaN. */
    static _Tp quiet_NaN() throw() { return static_cast<_Tp >(0); }
    /** The representation of a signaling "Not a Number," if
    @c has_signaling_N aN. */
    static _Tp signaling_NaN() throw() { return
    static_cast<_Tp >(0); }
    /** The minimum positive denormalized value. For types where
    @c has_denorm is false, this is the minimum positive
    normalized
    value. */
    static _Tp denorm_min() throw() { return static_cast<_Tp >(0); }
    };


    I've never actually seen that throw() syntax before, as I've always
    just had throw statements in the body of my code. At any rate, I
    thought that GCC might be trying to compile without exceptions, so I
    tried including the -fexceptions option to GCC, but that made no
    difference. So, any ideas what might get it going?

    Thanks.

    Dave
  • Gerry Ford

    #2
    Re: MinGW not so good with exceptions?


    "Dave the Funkatron" <dave.rudolf@us ask.cawrote in message
    news:20921642-3b06-4887-8f6f-78e9d492a701@u1 0g2000prn.googl egroups.com...
    Hey all,
    >
    I'm using MinGW as part of my toolchain in Eclipse, and I am trying to
    figure out why I am getting a compiler error when I include the
    <limitsheader .
    >
    The command that eclipse is running is
    >
    g++ -IC:\Dave\School \common\cxx -IC:\Dave\School \common\third party
    \packages\glut-3.7.6-bin\include -IC:\Dave\School \common\third party
    \packages\pthre ads-2005-03-08\Pre-built\include -O0 -g3 -Wall -c -
    fmessage-length=0 -ogllib\test_gll ib.o ..\gllib\test_g llib.cpp
    Is this an entry for the latest "Command line gone wild" video?

    >
    >
    >
    The error I get is:
    >
    In file included from C:/Dave/School/common/cxx/math/math_utils.h:13 ,
    from C:/Dave/School/common/cxx/gfx2d/color.h:9,
    from C:/Dave/School/common/cxx/gllib/gl_light.h:
    6, from ..\gllib\test_g llib.cpp:8:C:/mingw/bin/../lib/
    gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/limits:290: error:
    expected `;' before "throw"
    C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/
    limits:292: error: expected `;' before "static"
    C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/
    limits:292:22: macro "max" requires 2 arguments, but only 1 given
    >
    >
    >
    If I go and look at that code in MinGW's "limits" file, I see the
    following struct, in which the the static min() function is the first
    offending line of code:
    >
    template<typena me _Tp>
    struct numeric_limits : public __numeric_limit s_base
    {
    /** The minimum finite value, or for floating types with
    denormalization , the minimum positive normalized value. */
    static _Tp min() throw() { return static_cast<_Tp >(0); }
    /** The maximum finite value. */
    static _Tp max() throw() { return static_cast<_Tp >(0); }
    /** The @e machine @e epsilon: the difference between 1 and the
    least
    value greater than 1 that is representable. */
    static _Tp epsilon() throw() { return static_cast<_Tp >(0); }
    /** The maximum rounding error measurement (see LIA-1). */
    static _Tp round_error() throw() { return static_cast<_Tp >(0); }
    /** The representation of positive infinity, if @c
    has_infinity. */
    static _Tp infinity() throw() { return static_cast<_Tp >(0); }
    /** The representation of a quiet "Not a Number," if @c
    has_quiet_NaN. */
    static _Tp quiet_NaN() throw() { return static_cast<_Tp >(0); }
    /** The representation of a signaling "Not a Number," if
    @c has_signaling_N aN. */
    static _Tp signaling_NaN() throw() { return
    static_cast<_Tp >(0); }
    /** The minimum positive denormalized value. For types where
    @c has_denorm is false, this is the minimum positive
    normalized
    value. */
    static _Tp denorm_min() throw() { return static_cast<_Tp >(0); }
    };
    >
    >
    I've never actually seen that throw() syntax before, as I've always
    just had throw statements in the body of my code. At any rate, I
    thought that GCC might be trying to compile without exceptions, so I
    tried including the -fexceptions option to GCC, but that made no
    difference. So, any ideas what might get it going?
    Yeah, your folders have flourished like weeds. Trim them. Windows takes an
    exception to you.


    --
    Gerry Ford

    "Er hat sich georgiert." Der Spiegel, 2008, sich auf Chimpy Eins komma null
    beziehend.


    Comment

    • James Kanze

      #3
      Re: MinGW not so good with exceptions?

      On Feb 17, 10:42 am, "Gerry Ford" <inva...@invali d.netwrote:
      "Dave the Funkatron" <dave.rud...@us ask.cawrote in
      messagenews:209 21642-3b06-4887-8f6f-78e9d492a701@u1 0g2000prn.googl egroups.com...
      [...]
      The command that eclipse is running is
      g++ -IC:\Dave\School \common\cxx -IC:\Dave\School \common\third party
      \packages\glut-3.7.6-bin\include -IC:\Dave\School \common\third party
      \packages\pthre ads-2005-03-08\Pre-built\include -O0 -g3 -Wall -c -
      fmessage-length=0 -ogllib\test_gll ib.o ..\gllib\test_g llib.cpp
      Is this an entry for the latest "Command line gone wild" video?
      It's actually a lot shorter than one would expect. Compilers
      are very complex beasts, which have to be configured very
      exactly to do what one wants. My own makefiles generate command
      lines that are considerably longer.

      For commands generated by makefiles, who cares? For commands
      you actually do enter at the command line, you define a couple
      of shell variables, and use them. But just "g++ someProgram.cc"
      (or "cl someProgram.cc" with VC++) will not normally give you
      anything usable for anything other than a quick syntax test, if
      that.

      --
      James Kanze (GABI Software) email:james.kan ze@gmail.com
      Conseils en informatique orientée objet/
      Beratung in objektorientier ter Datenverarbeitu ng
      9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

      Comment

      • Dave the Funkatron

        #4
        Re: MinGW not so good with exceptions?

        On Feb 17, 1:42 am, "Gerry Ford" <inva...@invali d.netwrote:
        "Dave the Funkatron" <dave.rud...@us ask.cawrote in messagenews:209 21642-3b06-4887-8f6f-78e9d492a701@u1 0g2000prn.googl egroups.com...
        >
        Hey all,
        >
        I'm using MinGW as part of my toolchain in Eclipse, and I am trying to
        figure out why I am getting a compiler error when I include the
        <limitsheader .
        >
        The command that eclipse is running is
        >
        g++ -IC:\Dave\School \common\cxx -IC:\Dave\School \common\third party
        \packages\glut-3.7.6-bin\include -IC:\Dave\School \common\third party
        \packages\pthre ads-2005-03-08\Pre-built\include -O0 -g3 -Wall -c -
        fmessage-length=0 -ogllib\test_gll ib.o ..\gllib\test_g llib.cpp
        >
        Is this an entry for the latest "Command line gone wild" video?
        >
        >
        >
        >
        >
        >
        >
        The error I get is:
        >
        In file included from C:/Dave/School/common/cxx/math/math_utils.h:13 ,
                        from C:/Dave/School/common/cxx/gfx2d/color.h:9,
                        from C:/Dave/School/common/cxx/gllib/gl_light.h:
        6,                 from ..\gllib\test_g llib.cpp:8:C:/mingw/bin/../lib/
        gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/limits:290: error:
        expected `;' before "throw"
        C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/
        limits:292: error: expected `;' before "static"
        C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/
        limits:292:22: macro "max" requires 2 arguments, but only 1 given
        >
        If I go and look at that code in MinGW's "limits" file, I see the
        following struct, in which the the static min() function is the first
        offending line of code:
        >
         template<typena me _Tp>
           struct numeric_limits : public __numeric_limit s_base
           {
             /** The minimum finite value, or for floating types with
                 denormalization , the minimum positive normalized value.  */
             static _Tp min() throw() { return static_cast<_Tp >(0); }
             /** The maximum finite value.  */
             static _Tp max() throw() { return static_cast<_Tp >(0); }
             /** The @e machine @e epsilon:  the difference between 1 and the
        least
                 value greater than 1 that is representable.  */
             static _Tp epsilon() throw() { return static_cast<_Tp >(0); }
             /** The maximum rounding error measurement (see LIA-1).  */
             static _Tp round_error() throw() { return static_cast<_Tp >(0); }
             /** The representation of positive infinity, if @c
        has_infinity.  */
             static _Tp infinity() throw()  { return static_cast<_Tp >(0); }
             /** The representation of a quiet "Not a Number," if @c
        has_quiet_NaN. */
             static _Tp quiet_NaN() throw() { return static_cast<_Tp >(0); }
             /** The representation of a signaling "Not a Number," if
                 @c has_signaling_N aN. */
             static _Tp signaling_NaN() throw() { return
        static_cast<_Tp >(0); }
             /** The minimum positive denormalized value.  For types where
                 @c has_denorm is false, this is the minimum positive
        normalized
          value.  */
             static _Tp denorm_min() throw() { return static_cast<_Tp >(0);}
           };
        >
        I've never actually seen that throw() syntax before, as I've always
        just had throw statements in the body of my code. At any rate, I
        thought that GCC might be trying to compile without exceptions, so I
        tried including the  -fexceptions option to GCC, but that made no
        difference. So, any ideas what might get it going?
        >
        Yeah, your folders have flourished like weeds.  Trim them.  Windows takes an
        exception to you.
        >
        --
        Gerry Ford
        >
        "Er hat sich georgiert."  Der Spiegel, 2008, sich auf Chimpy Eins komma null
        beziehend.- Hide quoted text -
        >
        - Show quoted text -
        "Windows takes an exception to you" ?? Wow, you should watch your tone
        on the newsgroups, or people might think you are a jerk. People like
        me, for instance. This is especially true when you are giving
        irrelevant advice. Like James said, that's actually a pretty short
        command like. And, with the rise in storage capacity, paths are
        getting longer. If you like, you can keeep your dir structures nice
        and shallow, but I don't see why you care if mine are deep, or what
        that has to do with the above syntax error.

        Comment

        • Vaclav Haisman

          #5
          Re: MinGW not so good with exceptions?

          Dave the Funkatron wrote, On 17.2.2008 10:27:
          Hey all,
          >
          I'm using MinGW as part of my toolchain in Eclipse, and I am trying to
          figure out why I am getting a compiler error when I include the
          <limitsheader .
          >
          The command that eclipse is running is
          >
          g++ -IC:\Dave\School \common\cxx -IC:\Dave\School \common\third party
          \packages\glut-3.7.6-bin\include -IC:\Dave\School \common\third party
          \packages\pthre ads-2005-03-08\Pre-built\include -O0 -g3 -Wall -c -
          fmessage-length=0 -ogllib\test_gll ib.o ..\gllib\test_g llib.cpp
          >
          >
          >
          The error I get is:
          >
          In file included from C:/Dave/School/common/cxx/math/math_utils.h:13 ,
          from C:/Dave/School/common/cxx/gfx2d/color.h:9,
          from C:/Dave/School/common/cxx/gllib/gl_light.h:
          6, from ..\gllib\test_g llib.cpp:8:C:/mingw/bin/../lib/
          gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/limits:290: error:
          expected `;' before "throw"
          C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/
          limits:292: error: expected `;' before "static"
          C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/
          limits:292:22: macro "max" requires 2 arguments, but only 1 given
          That's problem with windows.h header. It or one of headers it includes
          defines macros min() and max() and those expand inside the C++ headers and
          result in the error.

          You should be able to fix it by making sure windows.h is included only after
          any standard C++ header. Or you can #undef min and #undef max before any
          standard C++ header. Or you can define NOMINMAX symbol before including
          windows.h so that it does not define the two macros.

          --
          VH

          Comment

          • James Kanze

            #6
            Re: MinGW not so good with exceptions?

            On Feb 18, 3:12 am, "Gerry Ford" <inva...@invali d.netwrote:
            This: C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4..5/
            >
            is unreadable and unwieldy.
            Which is totally irrelevant if you never see it nor write it
            yourself.

            In my own makefiles, I do expect the user to have set his path
            so that the compiler is found by simply "g++". Not because it
            makes command lines shorter however, but because it allows
            changing compiler versions simply by changing a few shell
            variables. A typical compiler invocation will still be well
            over a thousand characters, and a link using several libraries
            might be considerably more. Making a library is even worse,
            since the makefile generates the absolute filename for every
            file in the library (and the absolute filenames can easily
            be around 80 characters or more each).

            FWIW: a typical filename might be something like:
            /home/team02/jakan/generated/i80x86-linux-gcc/component/
            PrototypeFile/ProtoFileAsData Struct.o
            I don't see much that can be trimmed there.

            --
            James Kanze (GABI Software) email:james.kan ze@gmail.com
            Conseils en informatique orientée objet/
            Beratung in objektorientier ter Datenverarbeitu ng
            9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

            Comment

            Working...