Newbie question on try ... catch in ATL 
Author Message
 Newbie question on try ... catch in ATL

Hello,
      Every time I use try...catch in ATL project I got the following
message at compilation:

warning C4530: C++ exception handler used, but unwind semantics are not
enabled. Specify -GX

Is it critical? Anything else I can use in ATL if I want to do exception
handling?

Thanks in advance



Sat, 29 May 2004 21:52:06 GMT  
 Newbie question on try ... catch in ATL

Quote:

>       Every time I use try...catch in ATL project I got the following
> message at compilation:

> warning C4530: C++ exception handler used, but unwind semantics are not
> enabled. Specify -GX

> Is it critical? Anything else I can use in ATL if I want to do exception
> handling?

Why not specify -GX and make the compiler happy?  (Project settings,
C/C++ tab, "C++ Language", and check "Enable Exception Handling.")
Yes, that warning is a problem, it's telling you that with your current
settings, you're trying to catch exceptions but the compiler is set not
to generate code to unwind the stack.

As far as I know, this option is not in incompatible with ATL.



Sat, 29 May 2004 22:19:17 GMT  
 Newbie question on try ... catch in ATL
Essentially, the destructors of all objects created on the stack are
not called typically resulting in creating myriads of memory leaks.

If you use exceptions, you must also remove _ATL_MIN_CRT from the
settings for your release build, because you need the CRT when
using exceptions.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================


Quote:

> >       Every time I use try...catch in ATL project I got the following
> > message at compilation:

> > warning C4530: C++ exception handler used, but unwind semantics are not
> > enabled. Specify -GX

> > Is it critical? Anything else I can use in ATL if I want to do exception
> > handling?

> Why not specify -GX and make the compiler happy?  (Project settings,
> C/C++ tab, "C++ Language", and check "Enable Exception Handling.")
> Yes, that warning is a problem, it's telling you that with your current
> settings, you're trying to catch exceptions but the compiler is set not
> to generate code to unwind the stack.

> As far as I know, this option is not in incompatible with ATL.



Sun, 30 May 2004 12:56:59 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. newbie try throw and catch question

2. newbie Simple Try Catch question

3. TRY-CATCH vs. try-catch

4. try/catch VS TRY/CATCH

5. does atl support try..catch block?(empty inside)

6. newbie Q: debugging try/catch

7. try...catch newbie, please help

8. Can you catch CDBExection with try-catch keyword?

9. why {try catch} does not catch

10. Q: Why try catch cannot catch the exception

11. try-catch-finally question

12. Question about try-catch functions

 

 
Powered by phpBB® Forum Software