Skip to main content
gamedev.net
🔒 Locked

catch is undefined!?

Started by Shannon Barber Oct 11, 2001 at 11:14 AM 3 replies 850+ views
Original Post
Shannon Barber
Shannon Barber
Ok, my turn to play help the newbie with the compiler error: I attempted to reuse a DirectPlay class I wrote, and in it I use a map, which apparently includes xstring.
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xstring(527) : error C2059: syntax error : ''catch''
 
and the code aroudn the area:
  
		_TRY_BEGIN
			_S = allocator.allocate(_Ns + 2, (void *)0);
		_CATCH_ALL
			_Ns = _N;
			_S = allocator.allocate(_Ns + 2, (void *)0);
		_CATCH_END
[/souce]
The error is on the _CATCH_ALL macro, which is defined as
[source]
#define _CATCH_ALL	} catch (...) {
  
Now, I can only figure that there''s some setting that enables/disables exceptions OTHER than "Enable Exception Handling'' checkbox under the Projec->Settings->C/C++->C++ Language - That was the first thing I verified. Now, the thing that''s really bothering me about this, is that try must be defined. How on Earth could try be defined, but not catch? Magmai Kai Holmlor - Not For Rent
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Stoffel
Stoffel
My guess on the syntax error is that it''s not expecting catch at that time, not that catch is undefined. Also, you sure that the "MS extensions" tab isn''t toggled off? I don''t mess with the SEH, so I don''t have specific experience with this problem.
Shannon Barber
Shannon Barber
That''s an STL class, so I don''t think it shouldn''t be using SEH.

Somewhere within my hacking of a DirectShow filter example, I picked-up a section of pre-processor definitions: try=__try, except=__except, etc... but no catch=__catch. Which was good because I here bad stuff happens when C++ exceptions and SEH get confused.

Magmai Kai Holmlor
- Not For Rent
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Shannon Barber
Shannon Barber
I forgot to mention that Stoffel was right, it was a syntax error, not an undefined error - due to the pre-processor defintions it was trying to match up __try with catch.

Once I removed those [explenitive deleted] it compiled fine.
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.