Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / April 2007

Tip: Looking for answers? Try searching our database.

'exception' object in VS2005?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michael Bray - 25 Apr 2007 20:37 GMT
I'm converting a project from VS2003 to VS2005, and one of the most common
errors that I'm getting is on my try/catch blocks, where I used to do:

try { ... }
catch (exception &e) { ... }

VS2005 is complaining that 'exception' isn't recognized...  anyone know
what the resolution is to this?

TIA!

-mdb
David Wilkinson - 26 Apr 2007 00:47 GMT
> I'm converting a project from VS2003 to VS2005, and one of the most common
> errors that I'm getting is on my try/catch blocks, where I used to do:
[quoted text clipped - 4 lines]
> VS2005 is complaining that 'exception' isn't recognized...  anyone know
> what the resolution is to this?

Michael:

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

Signature

David Wilkinson
Visual C++ MVP

Bruno van Dooren - 26 Apr 2007 07:27 GMT
>> I'm converting a project from VS2003 to VS2005, and one of the most
>> common errors that I'm getting is on my try/catch blocks, where I used to
[quoted text clipped - 10 lines]
> #include <exception> ??
> using namespace std; ??

I had the same problem once, and you'd have the same problem if you migrate
from VC2003 to gcc.
In VC2003, exceptions are in the global namespace. In VC2005 (and gcc I seem
to remember) they are in std. That why you are getting those errors.

Signature

Kind regards,
   Bruno van Dooren  MVP - VC++
   http://msmvps.com/blogs/vanDooren
   bruno_nos_pam_van_dooren@hotmail.com

Michael Bray - 26 Apr 2007 15:42 GMT
Yup - it was the std:: namespace...  Thanks everyone!

-mdb

>> #include <exception> ??
>> using namespace std; ??
[quoted text clipped - 4 lines]
> I seem to remember) they are in std. That why you are getting those
> errors.
adebaene@club-internet.fr - 26 Apr 2007 09:29 GMT
On Apr 25, 9:37 pm, Michael Bray
<mbrayATctiusaDOT...@you.figure.it.out.com> wrote:
> I'm converting a project from VS2003 to VS2005, and one of the most common
> errors that I'm getting is on my try/catch blocks, where I used to do:
[quoted text clipped - 4 lines]
> VS2005 is complaining that 'exception' isn't recognized...  anyone know
> what the resolution is to this?

If you are using the STL class, then it is in the std namespace : use
catch(std::exception& e)

Arnaud
MVP - VC

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.