473,387 Members | 1,899 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,387 software developers and data experts.

'exception' object in VS2005?

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
Apr 25 '07 #1
4 1322
Michael Bray 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:

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

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

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

--
David Wilkinson
Visual C++ MVP
Apr 25 '07 #2
>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?

Michael:

#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.

--
Kind regards,
Bruno van Dooren MVP - VC++
http://msmvps.com/blogs/vanDooren
br**********************@hotmail.com
Apr 26 '07 #3
On Apr 25, 9:37 pm, Michael Bray
<mbrayATctiusaDOT...@you.figure.it.out.comwrote:
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?
If you are using the STL class, then it is in the std namespace : use
catch(std::exception& e)

Arnaud
MVP - VC
Apr 26 '07 #4
Yup - it was the std:: namespace... Thanks everyone!

-mdb
>#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.
Apr 26 '07 #5

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

Similar topics

19
by: Diego F. | last post by:
I think I'll never come across that error. It happens when running code from a DLL that tries to write to disk. I added permissions in the project folder, the wwwroot and in IIS to NETWORK_SERVICE...
9
by: Sharon | last post by:
I have a remoting object, lets call it A, that fires an event to remotely registered handlers, lets call it B. The invocation is working OK and the remote handler B is handling the event like it...
6
by: semedao | last post by:
Hi All, I had working code that made custom serialization on objects that inherit from queue in the inherited queue I create my own GetObjectData: public void GetObjectData(SerializationInfo info,...
6
by: Kristijan Marin | last post by:
Hi, Can please anyone tell me why do i get only the first method in which the exception was thrown and not the line that triggered the exception ? I don't know if I set something in VS2005 wrong...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.