473,769 Members | 7,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Feb 17 '08 #1
5 2482

"Dave the Funkatron" <da*********@us ask.cawrote in message
news:20******** *************** ***********@u10 g2000prn.google groups.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.
Feb 17 '08 #2
On Feb 17, 10:42 am, "Gerry Ford" <inva...@invali d.netwrote:
"Dave the Funkatron" <dave.rud...@us ask.cawrote in
messagenews:20* *************** *************** ***@u10g2000prn .googlegroups.c om...
[...]
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:ja******* **@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
Feb 17 '08 #3
On Feb 17, 1:42*am, "Gerry Ford" <inva...@invali d.netwrote:
"Dave the Funkatron" <dave.rud...@us ask.cawrote in messagenews:20* *************** *************** ***@u10g2000prn .googlegroups.c om...
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<typen ame _Tp>
* *struct numeric_limits : public __numeric_limit s_base
* *{
* * */** The minimum finite value, or for floating types with
* * * * *denormalizatio n, 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.
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\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
Feb 17 '08 #5
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:ja******* **@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
Feb 18 '08 #6

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

Similar topics

0
2178
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 short, about compiling with MinGW gcc: * it is possible;
1
2535
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: http://uucode.com/texts/python-mingw/python-mingw.html Having said that, kindly allow me to report that Mingw32 can
4
2010
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 MinGW Python passes the regrtests as follows. #----------------------------------------- # Python 2.3.4 Final:
188
8520
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 2.4 installer for windows. Now I have problems to compile python extension that some packages
5
6171
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. If I catch an exception with catch(...) the memory is never freed! so my computer can quickly get memory-exhausted. Here is the code that generates the problem. In VC++ I don't have this
2
1848
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: http://www.mingw.org/download.shtml Can someone please tell me how to go about doing it? Which are the executables and packages I need to download in order to do this? Thanks. LRS.
66
5495
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, please post it. Best Regards, Srijit
37
5074
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 redirect stderr to a temporary file (or /dev/null but is there an equivalent under Windows? Is it "nul:") and then to *restore* the default stderr so that standard library functions that write to stderr produce output again.
142
3981
by: opexoc | last post by:
Hello, I have question concerning such code: __try { ... } __except(EXCEPTION_EXECUTE_HANDLER) { printf("Exception code: %.8x\n", GetExceptionCode());
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10216
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.