473,406 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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\pthreads-2005-03-08\Pre-built\include -O0 -g3 -Wall -c -
fmessage-length=0 -ogllib\test_gllib.o ..\gllib\test_gllib.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_gllib.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<typename _Tp>
struct numeric_limits : public __numeric_limits_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_NaN. */
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
Feb 17 '08 #1
5 2467

"Dave the Funkatron" <da*********@usask.cawrote in message
news:20**********************************@u10g2000 prn.googlegroups.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\pthreads-2005-03-08\Pre-built\include -O0 -g3 -Wall -c -
fmessage-length=0 -ogllib\test_gllib.o ..\gllib\test_gllib.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_gllib.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<typename _Tp>
struct numeric_limits : public __numeric_limits_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_NaN. */
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.
Feb 17 '08 #2
On Feb 17, 10:42 am, "Gerry Ford" <inva...@invalid.netwrote:
"Dave the Funkatron" <dave.rud...@usask.cawrote in
messagenews:20**********************************@u 10g2000prn.googlegroups.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\pthreads-2005-03-08\Pre-built\include -O0 -g3 -Wall -c -
fmessage-length=0 -ogllib\test_gllib.o ..\gllib\test_gllib.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:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Feb 17 '08 #3
On Feb 17, 1:42*am, "Gerry Ford" <inva...@invalid.netwrote:
"Dave the Funkatron" <dave.rud...@usask.cawrote in messagenews:20**********************************@u 10g2000prn.googlegroups.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\pthreads-2005-03-08\Pre-built\include -O0 -g3 -Wall -c -
fmessage-length=0 -ogllib\test_gllib.o ..\gllib\test_gllib.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_gllib.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<typename _Tp>
* *struct numeric_limits : public __numeric_limits_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_NaN. */
* * *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.
Feb 17 '08 #4
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\pthreads-2005-03-08\Pre-built\include -O0 -g3 -Wall -c -
fmessage-length=0 -ogllib\test_gllib.o ..\gllib\test_gllib.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_gllib.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
Feb 17 '08 #5
On Feb 18, 3:12 am, "Gerry Ford" <inva...@invalid.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/ProtoFileAsDataStruct.o
I don't see much that can be trimmed there.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Feb 18 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Oleg A. Paraschenko | last post by:
Hello all, recently I compiled Python with MinGW gcc under Windows. If there are some interest, you can look at log of process at http://uucode.com/texts/python-mingw/python-mingw.html In...
1
by: A. B., Khalid | last post by:
Hello all. After a search on Google it would seem that the users of Mingw have not had good results in compiling the python sources natively. See at least: ...
4
by: A. B., Khalid | last post by:
Hello all. This is to inform those interested in getting Python to compile in MinGW that the pyMinGW patch is now able to help compile both Python 2.3.4 Final and Python 2.4a3 and the resulting...
188
by: Ilias Lazaridis | last post by:
I'm a newcomer to python: - E01: The Java Failure - May Python Helps? http://groups-beta.google.com/group/comp.lang.python/msg/75f0c5c35374f553 - I've download (as suggested) the python...
5
by: Mihai Oltean | last post by:
Hi I wrote a C++Builder program that throws/catch many exceptions (let's say 1.000.000/ hours). The problem is that I think that is a bug in the Borland C++Builder exception handling mechanism....
2
by: lrsk1260 | last post by:
I would like to install the MingW 3.4.2/g++ compiler(which, I presume, is the latest version) on my computer. I seem to be lost when I look at the MingW download page:...
66
by: Srijit Kumar Bhadra | last post by:
Is there any specific reason for not using MinGW to build the official distribution of Python for Win32? A quick Google search did not reveal the answer to my question. If a link is available,...
37
by: Vince C. | last post by:
Hi all. I've installed Bloodshed Dev-C++ on a Windows 2000 SP4 machine. I'm using MinGW 3.4.2. I'd like to temporarily disable standard functions to write to stderr, i.e. for instance...
142
by: opexoc | last post by:
Hello, I have question concerning such code: __try { ... } __except(EXCEPTION_EXECUTE_HANDLER) { printf("Exception code: %.8x\n", GetExceptionCode());
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.