Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » try/catch redefined as macros(__EXCEPTIONS macro is not parsed? catch(exception &x) blocks generate parse errors when x is used in catch body. )
try/catch redefined as macros [message #997511] Mon, 07 January 2013 21:59
Ted Holzman is currently offline Ted HolzmanFriend
Messages: 1
Registered: January 2013
Junior Member
Hi,

I am using Eclipse Juno/CDT on a Mac OSX 10.7.5 system.

The following tiny program:

#include <iostream>
#include <exception>
using namespace std;

class myexception: public exception
{
virtual const char* what() const throw(){return "My exception\n";}
virtual ~myexception(){}
} myex;

int main () {
try {
throw myex;
} catch (exception& e)
{cout << e.what() << endl;}
return 0;
}

...compiles and runs under g++, but the e.what() expression generates a parse error in eclipse. On further analysis I discovered that "try" and "catch" had been redefined as macros. And on further further analysis, I discovered that this is only supposed to happen when -fno-exceptions is specified. On the furthest analysis I attempted, I discovered that the system macro __EXCEPTIONS *was* defined, but seemed to be ignored.

Can anybody help me coerce eclipse to treat try and catch as keywords and not macros?
Or point me in the direction of the proper parts of the manual?

Thanks.
Previous Topic:How to set default breakpoint properties?
Next Topic:Error in Program
Goto Forum:
  


Current Time: Sun Dec 21 16:39:30 GMT 2014

Powered by FUDForum. Page generated in 0.01510 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software