CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2006
    Posts
    515

    DELETE_EXCEPTION(e) undefined

    I amusing DELETE_EXCEPTION(e) in my code but it gives compiler error:
    Code:
    error C3861: 'DELETE_EXCEPTION': identifier not found
    It is originally used in MFC in CArhive::ReadString() function
    Code:
            ........
    	CATCH(CArchiveException, e)
    	{
    		if (e && e->m_cause == CArchiveException::endOfFile)
    		{
    			DELETE_EXCEPTION(e);
    			if (nRead == 0)
    				return NULL;
    		}
    		else
    		{
    			THROW_LAST();
    		}
    	}
    	END_CATCH
    I need to clone this function in my application but DELETE_EXCEPTION gives error. I don't know where is it defined and since CArchive::ReadString() already builds, not sure why I am getting this error in the first place? Thanks.

  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: DELETE_EXCEPTION(e) undefined

    Quote Originally Posted by zspirit View Post
    I need to clone this function in my application but DELETE_EXCEPTION gives error. I don't know where is it defined
    c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\src\mfc\stdafx.h
    That is where it's located on my machine.

    Regards,

    Paul McKenzie

  3. #3
    Join Date
    Aug 2006
    Posts
    515

    Re: DELETE_EXCEPTION(e) undefined

    This is a little strange that there are going to be to files with same name "stdafx.h" included, the other being in the project folder. I wonder what would have happen if I add the include path for 'c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\atlmfc\src\mfc\stdafx.h'. How is the compiler going to decided which file do we want to add when it has both include paths? Maybe it will find the file in one folder and stop looking at the other!?

    On the other hand adding absolute path like that is not going to be great because the path may differ on difference PC. In my PC it is in Microsoft Visual Studio 10.0 folder

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: DELETE_EXCEPTION(e) undefined

    You should not add this include path.
    Instead #define this macro locally (if it is not #defined) or just replace it with
    Code:
    e->Delete();
    Also have a look at this thread.
    Last edited by VictorN; May 23rd, 2012 at 11:15 AM.
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured